#include<cstdio>
unsigned long long pow(unsigned long long m){
if(m==0)return 1;
if(m==1)return 2;
unsigned long long p=pow(m>>1);
if(m&1)return p*p%999999997*2%999999997;
return p*p%999999997;
}
int main(){
freopen("Hanoia.in","r",stdin);
freopen("Hanoia.out","w",stdout);
unsigned long long n;
scanf("%llu",&n);
unsigned long long ans=pow(n);
if(ans)printf("%llu",ans-1);
else printf("999999996");
fclose(stdin);fclose(stdout);
return 0;
}