#include using namespace std; typedef long long ll; ll n,m; ll res[5000010]; ll fiv(ll x,ll y){ if(res[x] != 0) return res[x]; if(x==1) return 0; if(x==2) return 1; res[x]=(fiv(x-1,y)+fiv(x-2,y))%y; return res[x]; } int main(){ ll n,m; cin>>n>>m; cout<