#!perl -pl ($a,$b,$c,$d)=split;$_=$a*$b%$d*$c%$d