#include <iostream>
using namespace std;
long long n,m,k,x;
long long quickpow(long long a,long long b){
long long ret=1;
while(b){
if(b%2==1) ret=(ret*a%n)%n;
a=a*a%n;
b/=2;
}
return ret%n;
}
int main(){
cin>>n>>m>>k>>x;
m%=n;
cout<<(x+m*quickpow(10,k))%n;
return 0;
}
一本通1617:转圈游戏
最新推荐文章于 2024-08-26 17:31:44 发布