#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int log10(int);
int pre_defined(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
size_t strlen(char *);
int main() {
  char buffer[1000001];
  scanf("%s", buffer);
  size_t digits = strlen(buffer);
  if (digits < 4) {
    printf("%d\n", pre_defined(atoi(buffer)));
  } else {
    int number = 6;
    double log_sum = 4 * log10(2) + 2 * log10(3) + log10(5);
    while (1) {
      log_sum += log10(++number);
      if (log_sum > digits) {
        printf("%d\n", number - 1);
        break;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4270,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xf4250(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xf4250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0xf4258(%rbp)
cmpq   $0x4,-0xf4258(%rbp)
04
jae    11cc <main+0x6c>
lea    -0xf4250(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   1050 <pre_defined@plt>
mov    %eax,%esi
lea    0xe61(%rip),%rdi
call   1040 <printf@plt>
jmp    12b2 <main+0x152>
movl   $0x6,-0xf425c(%rbp)
mov    $0x2,%edi
call   1070 <log10@plt>
shl    $0x2,%eax
mov    %eax,-0xf4270(%rbp)
mov    $0x3,%edi
call   1070 <log10@plt>
mov    %eax,%ecx
mov    -0xf4270(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xf426c(%rbp)
mov    $0x5,%edi
call   1070 <log10@plt>
mov    %eax,%ecx
mov    -0xf426c(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xf4268(%rbp)
ff
mov    -0xf425c(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0xf425c(%rbp)
call   1070 <log10@plt>
cvtsi2sd %eax,%xmm1
movsd  -0xf4268(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xf4268(%rbp)
ff
movsd  -0xf4268(%rbp),%xmm0
ff
movaps 0xd9f(%rip),%xmm2
movq   -0xf4258(%rbp),%xmm1
ff
punpckldq %xmm2,%xmm1
movapd 0xd9b(%rip),%xmm2
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    12a8 <main+0x148>
mov    -0xf425c(%rbp),%esi
sub    $0x1,%esi
lea    0xd85(%rip),%rdi
call   1040 <printf@plt>
jmp    12ad <main+0x14d>
jmp    1226 <main+0xc6>
jmp    12b2 <main+0x152>
xor    %eax,%eax
add    $0xf4270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xf4270,%rsp
lea    0xeae(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x3,%rax
ja     11a5 <main+0x45>
lea    0x20(%rsp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   1050 <pre_defined@plt>
mov    %eax,%ebx
jmp    122a <main+0xca>
mov    %rax,%r14
mov    $0x2,%edi
call   1070 <log10@plt>
mov    %eax,%ebx
shl    $0x2,%ebx
mov    $0x3,%edi
call   1070 <log10@plt>
lea    (%rbx,%rax,2),%ebp
mov    $0x5,%ebx
mov    $0x5,%edi
call   1070 <log10@plt>
add    %ebp,%eax
cvtsi2sd %eax,%xmm1
movq   %r14,%xmm0
punpckldq 0xe1a(%rip),%xmm0
subpd  0xe22(%rip),%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
lea    0x2(%rbx),%edi
call   1070 <log10@plt>
movsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm1
add    $0x1,%ebx
ucomisd 0x10(%rsp),%xmm1
jbe    1200 <main+0xa0>
lea    0xdf2(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf4270,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000001 x i8]
%3 = alloca i64
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
%6 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %3
%10 = load i64, i64* %3
%11 = icmp ult i64 %10, 4
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %2, i64 0, i64 0
%14 = call i32 @atoi(i8* %13)
%15 = call i32 @pre_defined(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %43
17: ; preds = %0
store i32 6, i32* %4
%18 = call i32 @log10(i32 2)
%19 = mul nsw i32 4, %18
%20 = call i32 @log10(i32 3)
%21 = mul nsw i32 2, %20
%22 = add nsw i32 %19, %21
%23 = call i32 @log10(i32 5)
%24 = add nsw i32 %22, %23
%25 = sitofp i32 %24 to double
store double %25, double* %5
br label %26
26: ; preds = %17, %41
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
%29 = call i32 @log10(i32 %28)
%30 = sitofp i32 %29 to double
%31 = load double, double* %5
%32 = fadd double %31, %30
store double %32, double* %5
%33 = load double, double* %5
%34 = load i64, i64* %3
%35 = uitofp i64 %34 to double
%36 = fcmp ogt double %33, %35
br i1 %36, label %37, label %41
37: ; preds = %26
%38 = load i32, i32* %4
%39 = sub nsw i32 %38, 1
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
br label %42
41: ; preds = %26
br label %26
42: ; preds = %37
br label %43
43: ; preds = %42, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [1000001 x i8]
%2 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i64 @strlen(i8* %2)
%5 = icmp ult i64 %4, 4
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @atoi(i8* %2)
%8 = call i32 @pre_defined(i32 %7)
br label %27
9: ; preds = %0
%10 = call i32 @log10(i32 2)
%11 = shl nsw i32 %10, 2
%12 = call i32 @log10(i32 3)
%13 = shl nsw i32 %12, 1
%14 = add nsw i32 %13, %11
%15 = call i32 @log10(i32 5)
%16 = add nsw i32 %14, %15
%17 = sitofp i32 %16 to double
%18 = uitofp i64 %4 to double
br label %19
19: ; preds = %19, %9
%20 = phi i32 [ 6, %9 ], [ %22, %19 ]
%21 = phi double [ %17, %9 ], [ %25, %19 ]
%22 = add nuw nsw i32 %20, 1
%23 = call i32 @log10(i32 %22)
%24 = sitofp i32 %23 to double
%25 = fadd double %21, %24
%26 = fcmp ogt double %25, %18
br i1 %26, label %27, label %19
27: ; preds = %19, %6
%28 = phi i32 [ %8, %6 ], [ %20, %19 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
ret i32 0
}