Under construction

Still being built. Things may change

Alea Iacta Est

Time limit0.5sMemory limit1024 MB

Summary
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.

  • 11 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, 55 and 99 both indicate the player who rolled.

At the Kaitakudan training camp, zuodong is called player 11. Going counterclockwise, the other players are called players 22, 33, and 44.

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 AA and BB, the faces of the two dice rolled first. (1≤A,B≤6)(1 \le A,B \le 6)

The second line contains two positive integers CC and DD, the faces of the two dice rolled second. (1≤C,D≤6)(1 \le C,D \le 6)

Output

Print the number of the player who becomes zhendong.

Examples2

  1. Example 1

    Input
    1 4
    4 5
    
    Expected output
    1
    
  2. Example 2

    Input
    2 2
    3 4
    
    Expected output
    2