坑点:
when an infant PuPu was born, all of its skins were opacity, and since the day that all of a PuPu’s skins has been changed from opacity to clarity, PuPu is an adult PuPu.
翻译:当所有皮肤都变过一次色的时候,成熟。。。所以也就是最内的一层变成透明再变成不透明所需要的时间
#include <iostream>
#include <cstdio>
#include <string.h>
typedef long long int lli;
using namespace std;
inline lli qp(lli a,lli x,lli c){
lli ans = 1;
for(;x;x>>=1){
if(x&1) ans = ans*a % c;
a = a*a % c;
}
ans = ((ans+1) % c + c)%c;
return ans;
}
int main(){
lli n;
while(scanf("%lld",&n),n){
lli ans = qp(2,n-1,n);
printf("%d\n",ans);
}
return 0;
}