#include<bits/stdc++.h>
using namespace std;
#define MAX 0x3f3f3f3f
int gcd(int a,int b)
{if(b==0)return a;else return gcd(b,a%b);
}
int w[2300][2300];
int dist[3000];
int flag[3000];
int main()
{memset(dist,MAX,sizeof(dist));memset(flag,0,sizeof(flag));dist[1]=0;for(int i=1;i<=2021;i++){for(int j=1;j<=2021;j++){if(i==j){w[i][j]=0;continue;}if(abs(i-j)>21)w[i][j]=MAX;else {int item=gcd(max(i,j),i+j-max(i,j));w[i][j]=i*j/item;} } }int s=1;int u;for(int i=2;i<=2021;i++){int Min=MAX;for(int j=1;j<=2021;j++){if (dist[j]<Min&&!flag[j]){Min=dist[j];u=j;}}flag[u]=1;for(int j=1;j<=2021;j++){if(!flag[j]){if(dist[u]+w[u][j]<dist[j])dist[j]=dist[u]+w[u][j];}} }cout<<"answer"<<dist[2021];return 0;
}