$/=words;say((+^-$/[3+$++]+$5-$2)%$/[$++]+1)xx 2