Drum
InterviewTime limit1sMemory limit1024 MB
Given hit counts X (left hand) and Y (right hand) per beat, print the order of hits in one beat: 1 for left, 2 for right, 3 for both.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Yeonghyeon, who is just starting to learn the drums, has a problem. Drumming depends on timing, but Yeonghyeon has serious trouble keeping the beat.
Sometimes the left and right hands must play in different rhythms. If the left hand must play times and the right hand times in one beat, the left hand plays every beat and the right hand plays every beat. For and , the order is (right) / (left) / (right) / (left + right), as shown in the figure.

When Yeonghyeon faces this situation, he cannot play at all. Find the order in which the drum should be played to help him.
Input
Two integers and are given on one line. is the number of times the left hand must play in one beat, and is the number of times the right hand must play in one beat. ()
Output
Print the order in which the drum is played. Print 1 if only the left hand plays, 2 if only the right hand plays, and 3 if both hands play.