#include <bits/stdc++.h>
#define int __int128
using namespace std;
int a, b, p;
long long ans;
inline int read()
{
int f = 1, x = 0;
char ch = getchar();
while(ch < '0' || ch > '9')
{
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
return x * f;
}
main()
{
freopen("64mul.in","r",stdin);
freopen("64mul.out","w",stdout);
a = read();
b = read();
p = read();
ans = a * b % p;
printf("%lld", ans);
return 0;
}