#include <iostream>
using namespace std;
int calnum(int a,int b)//求完后再 res = (x*y)/calnum(x,y) ;res即为所求
{
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
return a;
}
int main()
{
int n;
cin >> n;
//计算1到n+1的公倍数
int x1 = 1,y1;
int k = 1;
while(1)
{
if(k == n+1)
break;
y1 = k+1;
x1 = y1*(x1/calnum(x1,y1));
k++;
}
int x = n+1;
int y;
int n1 = n+1;
while(1)
{
if(x == x1)
break;
y = n1+1;
x = y*(x/calnum(x,y));
n1++;
y1 = k+1;
x1 = y1*(x1/calnum(x1,y1));
k++;
}
cout << k <<endl;
return 0;
}