#include<bits/stdc++.h>
using namespace std;
long long slowMul(long long a,long long b,long long p)
{
long long ans=0;
while(b)
{
if(b&1)ans=(ans+a)%p;
a=a*2%p;
b>>=1;
}
return ans;
}
int main()
{
long long a,b,p;
cin>>a>>b>>p;
cout<<slowMul(a,b,p);
return 0;
}
07-25
180
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)