#include #include #include #include #define MAX 48 uint32_t fib(int16_t x) { int16_t i; uint32_t prev0, prev1, result; if (x == 0) return 0; prev0 = 0; prev1 = 1; result = prev1; for (i=2; i=0; i--) { buf[i] %= 16; tot += (buf[i] * f); f *= 10; } return tot; } int32_t c2dd(int8_t *buf) { int8_t x; int16_t idx=0; while(1) { x = getchar(); if ((x > 47 && x < 58) == 0) break; buf[idx++] = x; } if (idx == 0) exit(0); return cs2dd(buf, idx); } int main() { int8_t buf[80]; int16_t x; uint32_t ret; while(1) { x = (int16_t)c2dd(buf); if ((x < MAX && x > -1) == 0) { printf("-1"); } else { ret = fib(x); printf("%"PRIu32, ret); } printf("\n"); } return 0; }