#include <iostream>
#include <utility>
#include <cassert>
using namespace std;
// return {fib_(n - 1), fib_n}
pair<int, int> fib_impl(unsigned int n) {
if (n == 0) return {1, 0};
if (n == 1) return {0, 1};
auto p = fib_impl(n - 1);
return {p.second, p.first + p.second};
}
int fib(unsigned int n) {
return fib_impl(n).second;
}
int main() {
assert(fib(2) == 1);
assert(fib(10) == 55);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPGNhc3NlcnQ+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKLy8gcmV0dXJuIHtmaWJfKG4gLSAxKSwgZmliX259CnBhaXI8aW50LCBpbnQ+IGZpYl9pbXBsKHVuc2lnbmVkIGludCBuKSB7CiAgICBpZiAobiA9PSAwKSByZXR1cm4gezEsIDB9OwogICAgaWYgKG4gPT0gMSkgcmV0dXJuIHswLCAxfTsKICAgIGF1dG8gcCA9IGZpYl9pbXBsKG4gLSAxKTsKICAgIHJldHVybiB7cC5zZWNvbmQsIHAuZmlyc3QgKyBwLnNlY29uZH07Cn0KCmludCBmaWIodW5zaWduZWQgaW50IG4pIHsKICAgIHJldHVybiBmaWJfaW1wbChuKS5zZWNvbmQ7Cn0KCmludCBtYWluKCkgewogICAgYXNzZXJ0KGZpYigyKSA9PSAxKTsKICAgIGFzc2VydChmaWIoMTApID09IDU1KTsKfQo=