St Andrews Online Judge

Prime Walk

By Kay Akashi

Time: 1000 ms
Memory: 256000 kB

The code judging system is only available during contests. Check out the github repo for test cases and solutions.

Please log in.

Problem Statement

You are given a positive integer, nn. You start a game on an xx-axis after receiving this number. First of all, you are standing on x=0x = 0. Starting from 11, you count the number until nn. When you are standing at cc and count ii (1in)(1 \leq i \leq n), if ii is not a prime number, you move rightward (hence you move from cc to c+ic + i). If ii is a prime number, you move leftward (hence you move from cc to cic - i). After completing this game, where will you be?

Note that, 11 is NOT a prime number.

Constraints

1n1041 \leq n \leq 10^{4}.

Subtask 1 (20%)

1n<1001 \leq n \lt 100.

Subtask 2 (80%)

100n104100 \leq n \leq 10^{4}.

Input

The input consists of one number, nn.

Output

Output the answer.

Examples

Input

5

Output

-5

Explanation

You are firstly at x=0x = 0. Then, you move in a following way: 0114050 → 1 → -1 → -4 → 0 → -5.

Input

200

Output

11646