#P9564. Dice Throw Verification
Dice Throw Verification
Dice Throw Verification
Dice are small, throwable objects with marked sides, typically used to produce random values in tabletop games. A common die is a cube with faces numbered from $1$ to $6$, where each face shows a pattern of $n$ round dots (called pips) for face $n$. In these dice, the pips on faces $1$ and $4$ are colored red, while the pips on faces $2$, $3$, $5$, and $6$ are black.
Little Cyan Fish claims that when he threw three dice, the total number of red pips facing up was exactly A and the total number of black pips facing up was exactly B. Your task is to verify whether it is possible to throw three dice so that the sum of the red pips equals $A$ and the sum of the black pips equals $B$.
Note: Each die has the following faces:
- Face 1: red=1, black=0
- Face 2: red=0, black=2
- Face 3: red=0, black=3
- Face 4: red=4, black=0
- Face 5: red=0, black=5
- Face 6: red=0, black=6
inputFormat
The input consists of a single line containing two integers A and B separated by space, where:
- A denotes the total number of red pips observed.
- B denotes the total number of black pips observed.
outputFormat
Output a single line: YES
if it is possible to throw three dice such that the total red pips equal A and the total black pips equal B; otherwise, output NO
.
sample
2 6
YES