#include #include #include #include #include #include using namespace std; void solve(); int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); } void solve() { int n,m; cin >> n >> m; int a1 = 0 % m; int a2 = 1 % m; for(int i = 3; i <= n; i++) { int tmp = (a1 + a2) % m; a1 = a2; a2 = tmp; } cout << a2 << endl; }