#include #include int main() { long long a,b,c,d; std::cin >> a >> b >> c >> d; long long LL = (a*b)%d; long long LLL = (LLL*c)%d; std::cout << LLL <