#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 log(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int N, D, C, res, i;
  double bact = 0.0;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d%d", &D, &C);
    if (bact < (double)C * log(D)) {
      bact = C * log(D);
      res = i;
    }
  }
  printf("%d\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeb4(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f2 <main+0xc2>
lea    0xe8d(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <log@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    11df <main+0xaf>
mov    -0x10(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <log@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e4 <main+0xb4>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <main+0x30>
mov    -0x14(%rbp),%esi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xebf(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xea0(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r12
xor    %ebp,%ebp
jmp    1179 <main+0x49>
xchg   %ax,%ax
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11d7 <main+0xa7>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x8(%rsp),%edi
call   1050 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x18(%rsp),%xmm0
ucomisd 0x10(%rsp),%xmm0
jbe    1170 <main+0x40>
mov    0x4(%rsp),%ebx
mov    0x8(%rsp),%edi
call   1050 <log@plt>
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%ebx
jmp    1170 <main+0x40>
lea    0xe27(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %7
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %6
br label %9
9: ; preds = %31, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %34
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%15 = load double, double* %7
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = load i32, i32* %3
%19 = call i32 @log(i32 %18)
%20 = sitofp i32 %19 to double
%21 = fmul double %17, %20
%22 = fcmp olt double %15, %21
br i1 %22, label %23, label %30
23: ; preds = %13
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = call i32 @log(i32 %25)
%27 = mul nsw i32 %24, %26
%28 = sitofp i32 %27 to double
store double %28, double* %7
%29 = load i32, i32* %6
store i32 %29, i32* %5
br label %30
30: ; preds = %23, %13
br label %31
31: ; preds = %30
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %9
34: ; preds = %9
%35 = load i32, i32* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br label %10
10: ; preds = %0, %28
%11 = phi double [ %30, %28 ], [ 0.000000e+00, %0 ]
%12 = phi i32 [ %31, %28 ], [ 0, %0 ]
%13 = phi i32 [ %29, %28 ], [ undef, %0 ]
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = load i32, i32* %2
%18 = call i32 @log(i32 %17)
%19 = sitofp i32 %18 to double
%20 = fmul double %16, %19
%21 = fcmp olt double %11, %20
br i1 %21, label %22, label %28
22: ; preds = %10
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 @log(i32 %24)
%26 = mul nsw i32 %25, %23
%27 = sitofp i32 %26 to double
br label %28
28: ; preds = %10, %22
%29 = phi i32 [ %12, %22 ], [ %13, %10 ]
%30 = phi double [ %27, %22 ], [ %11, %10 ]
%31 = add nuw nsw i32 %12, 1
%32 = load i32, i32* %1
%33 = icmp slt i32 %31, %32
br i1 %33, label %10, label %34
34: ; preds = %28
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
ret i32 0
}