#include <iostream>
typedef long long ll;
using namespace std;
bool ll_is_valid(ll t, ll N, ll x, ll y)
{
return t / x + (t - x) / y >= N;
}
ll f(ll N, ll x, ll y)
{
ll R = 1;
while (!ll_is_valid(R,N,x,y)) R *= 2;
ll L = R / 2;
while(R - L > 1)
{
ll M = (L + R) / 2;
if (!ll_is_valid(M,N,x,y)) {L = M;}
else {R = M;}
}
return R;
}
int main()
{
ll N,x,y;
cin >> N >> x >> y;
if(x > y) swap( x, y );
cout << f(N, x, y) << std::endl;
}
function pr(a:longint ):boolean;
var d:longint;
begin
if a<2 then pr:=false
else
begin
pr:=true;
for d:=2 to round(sqrt(a)) do
if a mod d=0 then pr:=false;
end;
end;
function isch(var x: longint ): boolean;
var s: longint;
begin
s:=0;
isch:=false;
while ( x<>0 ) do
begin
s := s + (x mod 10);
x:= x div 10;
end;
if s mod 2=0 then isch:=true;
end;
var k,n,i,c: longint;
y: boolean;
begin
readln(k,n);
if (k>=2) and (n<=100000) then
begin
y:=true;
for i:=k to n do
begin
c:=i;
if (pr(c)) and (isch(c)) then
begin
write(i,' ');
y:=false;
end;
end;
if y then write('0');
end;
end.