10084: ABC346 —— B - Piano
[Creator : ]
Description
> There is an infinitely long piano keyboard. Is there a continuous segment within this keyboard that consists of $W$ white keys and $B$ black keys?
Let $S$ be the string formed by infinitely repeating the string `wbwbwwbwbwbw`.
Is there a substring of $S$ that consists of $W$ occurrences of `w` and $B$ occurrences of `b`?
What is a substring of $S$? A substring of $S$ is a string that can be formed by concatenating the $l$-th, $(l+1)$-th, $\dots$, $r$-th characters of $S$ in this order for some two positive integers $l$ and $r$ $(l\leq r)$.
Let $S$ be the string formed by infinitely repeating the string `wbwbwwbwbwbw`.
Is there a substring of $S$ that consists of $W$ occurrences of `w` and $B$ occurrences of `b`?
What is a substring of $S$? A substring of $S$ is a string that can be formed by concatenating the $l$-th, $(l+1)$-th, $\dots$, $r$-th characters of $S$ in this order for some two positive integers $l$ and $r$ $(l\leq r)$.
Input
The input is given from Standard Input in the following format:
```
$W$ $B$
```
```
$W$ $B$
```
Output
If there is a substring of $S$ that consists of $W$ occurrences of `w` and $B$ occurrences of `b`, print `Yes`; otherwise, print `No`.
Constraints
- $W$ and $B$ are integers.
- $0\leq W,B \leq 100$
- $W+B \geq 1$
- $0\leq W,B \leq 100$
- $W+B \geq 1$
Sample 1 Input
3 2
Sample 1 Output
Yes
The first 15 characters of S are wbwbwwbwbwbwwbw. You can take the 11-th through 15-th characters to form the string bwwbw, which is a substring consisting of three occurrences of w and two occurrences of b.
Sample 2 Input
3 0
Sample 2 Output
No
The only string consisting of three occurrences of w and zero occurrences of b is www, which is not a substring of S.
Sample 3 Input
92 66
Sample 3 Output
Yes