#include #include #include #include #include int main(void) { long long int total=0,mod,num; scanf("%lld %lld",&num,&mod); for (int i=0,b=1,c=0;i<=num;i++) { total = b; b = c; c = total + b; } total%=mod; printf("%lld",total); }