Komorebi的数学课
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
const int N=100010,mod=1e9+7;
typedef long long LL;
typedef pair<int,int>PII;
int n,m;
LL qmi(int a, int b, int p)
{
LL res = 1 % p;
while (b)
{
if (b & 1) res = res * a % p;
a = a * (LL)a % p;
b >>= 1;
}
return res;
}
int main()
{
cin>>n;
cout<<qmi(n,n,n+2);
return 0;
}