#include <iostream>
using namespace std;
int arr[1000001] = { 0, 1, 2 };
int solution(int n)
{
if (n == 0) return 0;
else if (n == 1)return 1;
else if (arr[n]) return arr[n];
else return arr[n] = (solution(n - 1) + solution(n - 2)) % 15746;
}
int main(void)
{
int N;
cin >> N;
cout << solution(N);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBhcnJbMTAwMDAwMV0gPSB7IDAsIDEsIDIgfTsKCmludCBzb2x1dGlvbihpbnQgbikKewoJaWYgKG4gPT0gMCkgcmV0dXJuIDA7CgllbHNlIGlmIChuID09IDEpcmV0dXJuIDE7CgllbHNlIGlmIChhcnJbbl0pIHJldHVybiBhcnJbbl07CgllbHNlIHJldHVybiBhcnJbbl0gPSAoc29sdXRpb24obiAtIDEpICsgc29sdXRpb24obiAtIDIpKSAlIDE1NzQ2Owp9CmludCBtYWluKHZvaWQpCnsKCWludCBOOwoJY2luID4+IE47Cgljb3V0IDw8IHNvbHV0aW9uKE4pOwoJcmV0dXJuIDA7Cn0=