#include <cstdio>
#include <map>
using namespace std;
map<long long, long long> m;
const long long md = 32951280099+1000;//需要模的数
long long f(const int x) {
if(x <= 2) return x ? 1 : 0;
if(m.count(x)) return m[x];
const int k = x >> 1;
const long long a = f(k);
const long long b = f(k + 1);
if(x & 1) return m[x] = (a * a + b * b) % md;
else return m[x] = a * (b + b - a + md) % md;
}
int main() {
freopen("Keller_T3.in","r",stdin);
freopen("Keller_T3.out","w",stdout);
int n;
scanf("%d", &n);
printf("%d\n", int(f(n + 2)));
return 0;
}