#include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
n = n%2040;
int state1(1),state2(1),state3(0);
if(n==1)cout << state1;
else if(n==2)cout << state2;
else
{
while(n>=3)
{
if(n%2==0)
{
state3 = (state1+state2)%2010;
state1 = state3;
}
else
{
state3 = (state1+state2)%2010;
state2 = state3;
}
n--;
}
}
cout << state3 << endl;
/*
*找到循环节
int n(4);
int state1(2),state2(3);
while(!(state1==1&&state2==1)&&n<=2044)
{
if(n%2==0)
state1 = (state1+state2)%2010;
else
state2 = (state1+state2)%2010;
n++;
cout<<state1<<state2<< endl;
}
cout << n;
*结果是2040就恢复到初始状态
*/
return 0;
}
using namespace std;
int main()
{
long long n;
cin >> n;
n = n%2040;
int state1(1),state2(1),state3(0);
if(n==1)cout << state1;
else if(n==2)cout << state2;
else
{
while(n>=3)
{
if(n%2==0)
{
state3 = (state1+state2)%2010;
state1 = state3;
}
else
{
state3 = (state1+state2)%2010;
state2 = state3;
}
n--;
}
}
cout << state3 << endl;
/*
*找到循环节
int n(4);
int state1(2),state2(3);
while(!(state1==1&&state2==1)&&n<=2044)
{
if(n%2==0)
state1 = (state1+state2)%2010;
else
state2 = (state1+state2)%2010;
n++;
cout<<state1<<state2<< endl;
}
cout << n;
*结果是2040就恢复到初始状态
*/
return 0;
}