#include <bits/stdc++.h>
const int maxn = 5000000;
int p[maxn];
int ans[maxn];
int flag[maxn];
int tot;
bool isprime(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
int check(int x) {
  int sum = 0;
  for (; x; x /= 10) sum = sum * 10 + x % 10;
  return sum;
}
int main() {
  int n, i, j;
  int b = 0;
  scanf("%d", &n);
  while (n) {
    b++;
    if (b != check(b) && isprime(b) && isprime(check(b))) n--;
  }
  printf("%d\n", b);
}

### Prompt

Please create a solution in Cpp to the following problem:

qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf.

Input

jxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 ≤ d ≤ 11184) — jxu edu-rqiut ydtun ev jxu ucyhf je vydt.

Output

ekjfkj q iydwbu dkcruh.

Examples

Input

1


Output

13

### Response

```cpp
#include <bits/stdc++.h>
const int maxn = 5000000;
int p[maxn];
int ans[maxn];
int flag[maxn];
int tot;
bool isprime(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
int check(int x) {
  int sum = 0;
  for (; x; x /= 10) sum = sum * 10 + x % 10;
  return sum;
}
int main() {
  int n, i, j;
  int b = 0;
  scanf("%d", &n);
  while (n) {
    b++;
    if (b != check(b) && isprime(b) && isprime(check(b))) n--;
  }
  printf("%d\n", b);
}

```