Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 300 点
問題文
整数 N があります。
2, 3, \ldots, N のどれで割っても 1 余る、N 以上 10^{13} 以下の整数を 1 つ出力してください。
この問題の制約下では、そのような整数は必ず 1 つ以上存在します。
制約
- 入力は全て整数
- 2 \leq N \leq 30
入力
入力は以下の形式で標準入力から与えられる。
N
出力
2, 3, \ldots, N のどれで割っても 1 余る、N 以上 10^{13} 以下の整数を 1 つ出力せよ。
そのような整数が複数存在する場合、どれを出力しても構わない。
入力例 1
3
出力例 1
7
7 を 2 で割った余りは 1、7 を 3 で割った余りは 1 です。
7 は 3 以上 10^{13} 以下の整数なので、条件を満たします。
入力例 2
10
出力例 2
39916801
Score : 300 points
Problem Statement
We have an integer N.
Print an integer x between N and 10^{13} (inclusive) such that, for every integer y between 2 and N (inclusive), the remainder when x is divided by y is 1.
Under the constraints of this problem, there is always at least one such integer x.
Constraints
- All values in input are integers.
- 2 \leq N \leq 30
Input
Input is given from Standard Input in the following format:
N
Output
Print an integer x between N and 10^{13} (inclusive) such that, for every integer y between 2 and N (inclusive), the remainder when x is divided by y is 1.
If there are multiple such integers, any of them will be accepted.
Sample Input 1
3
Sample Output 1
7
The remainder when 7 is divided by 2 is 1, and the remainder when 7 is divided by 3 is 1, too.
7 is an integer between 3 and 10^{13}, so this is a desirable output.
Sample Input 2
10
Sample Output 2
39916801