Alea Iacta Est
Time limit0.5sMemory limit1024 MB
Given two dice rolls for zuodong and then jiadong among four seated players, the task is to print the number of the player who becomes zhendong.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
The die has been cast.
Mahjong is a game of completing hands with 14 tiles (pai). Four players sit around a square table and play counterclockwise.
In Mahjong, the player who sits east at the start of the game is called zhendong (眞東). Because who becomes zhendong matters, Mahjong limits the players' ability to manipulate the outcome. Two dice are rolled twice to decide east.
The player who rolls first is called zuodong (坐東). The player indicated by the sum of zuodong's two dice becomes jiadong (假東). Jiadong rolls second, and the player indicated by the sum of jiadong's two dice becomes zhendong.
A player indicated by a dice sum is defined as follows.
- indicates the player who rolled the dice.
- Count counterclockwise from there to reach the next player.
- After the last player, start again from the player who rolled. For example, and both indicate the player who rolled.
At the Kaitakudan training camp, zuodong is called player . Going counterclockwise, the other players are called players , , and .
Given the results of rolling two dice twice, print the number of the player who becomes zhendong.
Input
The first line contains two positive integers and , the faces of the two dice rolled first.
The second line contains two positive integers and , the faces of the two dice rolled second.
Output
Print the number of the player who becomes zhendong.