#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,k,x;
ll ksm(ll aa,ll bb){
ll result=1;
while(bb){
if(bb%2==1){
result=result*aa%n;
bb--;
}
aa=aa*aa%n;
bb/=2;
}
return result;
}
int main(){
cin>>n>>m>>k>>x;
cout<<(ksm(10,k)*m+x)%n<<endl;
return 0;
}
07-27
1059
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-07