#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
int a, b, c, d, k;
a = 1;
b = 1;
c = 2;
bool x;
int counter = 0;
while (counter < n){
x = true;
c = a + b;
a = b;
b = c;
for (int j = 2; j <= sqrt(c) && x; j++) {
if((c%j) == 0){
x = false;
}
}
if (x){
counter ++;
}
}
cout << c;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBuOwoJY2luID4+IG47CglpbnQgYSwgYiwgYywgZCwgazsKCWEgPSAxOwoJYiA9IDE7CgljID0gMjsKCWJvb2wgeDsKCWludCBjb3VudGVyID0gMDsKCXdoaWxlIChjb3VudGVyIDwgbil7CgkJeCA9IHRydWU7CgkJYyA9IGEgKyBiOwoJCWEgPSBiOwoJCWIgPSBjOwoJCWZvciAoaW50IGogPSAyOyBqIDw9IHNxcnQoYykgJiYgeDsgaisrKSB7CgkJCWlmKChjJWopID09IDApewoJCQkJeCA9IGZhbHNlOwoJCQl9CgkJfQoJCWlmICh4KXsKCQkJY291bnRlciArKzsKCQl9Cgl9Cgljb3V0IDw8IGM7CglyZXR1cm4gMDsKfQ==