PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000314. Số dư đồng nhất (Redundant Redundancy)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số dư đồng nhất (Redundant Redundancy)

Redundant Redundancy

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer NN, find an integer xx satisfying both conditions:

  • N≤x≤1013N\le x\le 10^{13}.
  • For every integer yy from 22 through NN, the remainder of xx divided by yy equals 11.

The constraints guarantee at least one valid integer xx. If several answers exist, you may print any valid one.

Input

One line containing integer NN.

Output

Print any integer xx satisfying all requirements.

Subtasks

  • Subtask 0 (20 points): 2≤N≤82\le N\le 8; the output must satisfy N≤x≤1013N\le x\le 10^{13} and x mod y=1x\bmod y=1 for every 2≤y≤N2\le y\le N.
  • Subtask 1 (30 points): 2≤N≤202\le N\le 20; the output must satisfy N≤x≤1013N\le x\le 10^{13} and x mod y=1x\bmod y=1 for every 2≤y≤N2\le y\le N.
  • Subtask 2 (50 points): 2≤N≤302\le N\le 30; the output must satisfy N≤x≤1013N\le x\le 10^{13} and x mod y=1x\bmod y=1 for every 2≤y≤N2\le y\le N.

Examples

Example 1

Input

3

Output

7

Explanation

The integer 77 lies in [3,1013][3,10^{13}], and both 7 mod 27\bmod2 and 7 mod 37\bmod3 equal 11. The integer 1313 is also valid; your output need not match the sample exactly.

Example 2

Input

10

Output

39916801

Explanation

Since 39916801=11!+139916801=11!+1, and 11!11! is divisible by every integer from 22 through 1010, the remainder is always 11. Another valid output is 25212521, since 25202520 is divisible by each of those integers.