#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef __int128 LLL;
//long long 存不下怎么办?用 __int128!
LL mul(LLL a, LLL b, LLL p){
return (a * b) % p;
}
int main()
{
LL a, b, p;
cin >> a >> b >> p;
cout << mul(a, b, p) << '\n';
return 0;
}