#include #include "bits/stdc++.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; const int INF = 1e8; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) using namespace std; typedef pair P; ll n, m; ll memo[5000000]; ll fib( ll n){ if(n ==1){ return 0; } if(n ==2){ return 1; } if(memo[n]){ return memo[n]; } memo[n] = (fib(n-1)+fib(n-2))%m; return memo[n]; } int main() { cin>>n>>m; cout<