1LL

// cpp typecast long long so that integer overflow can't happen

((((1LL*k*k)%m)*x)%m);
// 1LL means type to long long
paramjeetdhiman