#include <bits/stdc++.h>
using namespace std;
int check_prosto(int pr) {
  unsigned long long int i;
  for (i = 2; i <= sqrt(pr); i++) {
    if (pr % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  unsigned long long int i, c, p;
  int a, br = 0;
  cin >> a;
  for (i = 10; br < a; i++) {
    if (check_prosto(i) == 1) {
      c = 0;
      p = i;
      while (p > 0) {
        c = c + p % 10;
        c = c * 10;
        p = p / 10;
      }
      c = c / 10;
      if (check_prosto(c) == 1) {
        if (c == i) {
        } else {
          br++;
        }
      }
    }
  }
  cout << i - 1 << endl;
  return 0;
}

### 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>
using namespace std;
int check_prosto(int pr) {
  unsigned long long int i;
  for (i = 2; i <= sqrt(pr); i++) {
    if (pr % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  unsigned long long int i, c, p;
  int a, br = 0;
  cin >> a;
  for (i = 10; br < a; i++) {
    if (check_prosto(i) == 1) {
      c = 0;
      p = i;
      while (p > 0) {
        c = c + p % 10;
        c = c * 10;
        p = p / 10;
      }
      c = c / 10;
      if (check_prosto(c) == 1) {
        if (c == i) {
        } else {
          br++;
        }
      }
    }
  }
  cout << i - 1 << endl;
  return 0;
}

```