#include <fstream>
#include <queue>
using namespace std;
ifstream f("fabrica.in");
ofstream g("fabrica.out");
int n,na,nb,t[100005],sol,solutie[100005],costa[50005],costb[50005];
priority_queue<pair <int,int>,vector<pair<int,int>>,greater<pair < int,int>>> q;
pair <int,int> x;
int main()
{
f>>n>>na>>nb;
for(int i=1; i<=na; i++)
{
f>>costa[i];
q.push({costa[i],i});
}
for(int i=1; i<=n; i++)
{
x=q.top();
q.pop();
t[i]=x.first;
q.push({x.first+costa[x.second],x.second});
}
while(!q.empty())
{
q.pop();
}
g<<t[n]<<" ";
for(int i=1; i<=nb; i++)
{
f>>costb[i];
q.push({costb[i],i});
}
for(int i=1; i<=n; i++)
{
x=q.top();
q.pop();
solutie[i]=t[n-i+1]+x.first;
q.push({x.first+costb[x.second],x.second});
sol=max(sol,solutie[i]);
}
g<<sol<<'\n';
return 0;
}