#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int yh(int x)
{
int j,he=0;
for(j=2;j<x;j++)
{
if(x%j==0)
{
he=he+j;
}
}
return he;
}
int main()
{
int s,a,b,i,yuea,yueb;
cin >>s;
for(i=s; ;i++)
{
yuea=yh(i);
a=i;
b=yuea;
yueb=yh(b);
if(yueb==a)
{
cout <<a<<" "<<b;
break;
}
}
cout <<endl;
return 0;
}