include
include
define ull unsigned long long
define ll long long
using namespace std;
int main() { ll a, b, m; cin >> a >> b >> m; ll q = (long double)a * b / m; ll res = a * b — q * m; while(res < 0) { res += m; } while(res >= m) { res -= m; } cout << res; }