#include #include using namespace std; int main(){ long long int a,b,c,d,ans; cin>>a>>b>>c>>d; ans = (a%d*b%d*c%d)%d; cout << ans <