No.726 Tree Game
Problem Statement
There is a grid with $10^{1333}\ $ rows and $10^{1333}\ $ columns, and 1 tree.
The cell in row $i\ (1 ≦ i ≦ 10^{1333}\ )$ and column $j\ (1 ≦ j ≦ 10^{1333}\ )$ is called cell $(i, j)$. Here, the bottom-left cell is cell $(1, 1)$ and the top-right cell is cell $(10^{1333}\ , 10^{1333}\ )$.
Also, cell $(i, j)$ is called a prime cell if $i$ or $j$ is a prime number.
Using this grid and the tree, $2$ players play the following game.
Initially, the tree is growing on cell $(Y, X)$.
On their turn, a player must move the tree to the cell $1$ above or $1$ to the right.
That is, if the tree is currently growing on cell $(Y, X)$, the player must move the tree to cell $(Y + 1, X)$ or cell $(Y, X + 1)$.
The players take turns alternately, and the player who moves the tree to a prime cell loses. (The other player wins.)
Note that if a player cannot move within the bounds, the player who cannot move loses.
Given positive integers $Y, X$, determine which of the first player and the second player wins when both players play optimally.
Input
$Y\ X$
Positive integers $Y, X$ are given, separated by a space.
They satisfy $1 \leqq Y, X \leqq 10^9$.
Output
Print First if the first player wins, and Second if the second player wins. Print a newline at the end.
Sample
Sample 1
Input
22 16
Output
Second
The first player can move the tree to cell $(23, 16)$ or cell $(22, 17)$, but both are prime cells, so the second player wins.
Sample 2
Input
59 56
Output
First
The initial position may be a prime cell. (The player who moves the tree to a prime cell loses.)
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
treeone
Lemma299