// yukicoder: No.428 小数から逃げる夢 // 2019.4.17 bal4u #include #include #if 1 #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) #else #define gc() getchar() #define pc(c) putchar(c) #endif int in() { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } void outs(char *s) { while (*s) pc(*s++); } #define N 1000000000 char *s = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; int num[30]; int ans[30]; char _ans[200]; void mpStr2Num(int *num, char *str, int len) { char *ss = str + len; int *nn = num, k = 1, x = 0; do { x += (*--ss - '0') * k; k *= 10; if (k == N || ss == str) *++nn = x, x = 0, k = 1; } while (ss != str); *num = nn - num; } void mpNum2Str(char *str, int *num) { int i, j, x; char *ss; if (*num == 0 || (*num == 1 && *(num + 1) == 0)) { *str++ = '0', *str = '\0'; return; } ss = str - 1; for (i = *num; i > 0; i--) { x = *++num; for (j = 1; j < N; j *= 10) { *++ss = x % 10 + '0'; x /= 10; } } while (*ss == '0') ss--; *(ss + 1) = '\0'; while (str < ss) { x = *str; *str++ = *ss; *ss-- = x; } } void mpMul(int *ret, int *a, int b) { int i, la, ca, *aa; long long x; la = *a; for (i = la + 1; i > 0; i--) *(ret + i) = 0; ca = 0; for (i = 1, aa = a; i <= la; i++) { x = *++aa; x = x * b + *(ret + i) + ca; *(ret + i) = x % N; ca = (int)(x / N); } *(ret + i) = ca; *ret = (ca != 0) ? la + 1 : la; } int main() { int n; n = in(); mpStr2Num(num, s, strlen(s)); mpMul(ans, num, n); mpNum2Str(_ans, ans); if (n <= 8) pc('0'), pc('.'), outs(_ans); else if (n <= 81) pc(_ans[0]), pc('.'), outs(_ans+1); else pc(_ans[0]), pc(_ans[1]), pc('.'), outs(_ans + 2); pc('\n'); return 0; }