#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define rush() int T;cin>>T;while(T--)
#define go(a) while(cin>>a)
#define ms(a,b) memset(a,b,sizeof a)
#define E 1e-8
#define debug(a) cout<<"*"<<a<<"*"<<endl
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PAUSE system("pause")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pair;
const int inf=0x3f3f3f3f;
const int mod=100003;
const int N=2e5+5;
int n,m,t;
int i,j,k;
ll pow_mod(ll a,ll res,ll mod){
ll ans=1;
while(res){
if(res&1) ans=ans*a%mod;
a=a*a%mod;
res>>=1;
}
if(ans%mod) return ans%mod;
else return mod;
}
int main(){
ll m,n; cin>>m>>n;
if(n==1){
return 0*puts("0");
}
else{
cout<<(pow_mod(m,n,mod)-pow_mod(m-1,n-1,mod)*m%mod+mod)%mod<<endl;
}
return 0;
}
一本通1618:越狱
最新推荐文章于 2024-07-07 18:34:32 发布