#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *, ...);
int main() {
  int i, j, k, n, m, x, y, doudou;
  while (scanf("%d", &n) != EOF) {
    for (m = 1; m <= n; m++) {
      scanf("%d %d", &x, &y);
      for (i = 0; i <= 100; i++) {
        if (x * (100 - y) + i * y >= 6000) {
          break;
        }
      }
      if (i <= 100)
        printf("%d\n", i);
      else
        printf("poor guy\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2ea0(%rip),%rcx
cmp    (%rcx),%rax
je     120b <main+0xeb>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1206 <main+0xe6>
lea    0xe95(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     11c5 <main+0xa5>
mov    -0x1c(%rbp),%eax
mov    $0x64,%ecx
sub    -0x20(%rbp),%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    %ecx,%eax
cmp    $0x1770,%eax
jl     11b2 <main+0x92>
jmp    11c5 <main+0xa5>
jmp    11b7 <main+0x97>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1181 <main+0x61>
cmpl   $0x64,-0x8(%rbp)
jg     11e5 <main+0xc5>
mov    -0x8(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <main+0xd3>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xd8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <main+0x38>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%rax
jne    116e <main+0x3e>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe8b(%rip),%r12
lea    0x14(%rsp),%r13
lea    0x10(%rsp),%r14
jmp    11af <main+0x7f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe6c(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%rax
je     115d <main+0x2d>
cmpl   $0x0,0xc(%rsp)
jle    1190 <main+0x60>
mov    $0x1,%r15d
jmp    11df <main+0xaf>
xchg   %ax,%ax
add    $0xfffffffd,%esi
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%r15),%eax
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jge    1190 <main+0x60>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
mov    $0x64,%ecx
sub    %eax,%ecx
imul   0x14(%rsp),%ecx
lea    (%rax,%rax,1),%edx
lea    0x0(,%rax,4),%edi
lea    (%rax,%rax,2),%ebp
mov    $0x3,%esi
cmp    $0x176f,%ecx
jg     11c0 <main+0x90>
nopl   0x0(%rax)
cmp    $0x67,%esi
je     1260 <main+0x130>
lea    (%rax,%rcx,1),%ebx
cmp    $0x176f,%ebx
jg     1271 <main+0x141>
lea    (%rdx,%rcx,1),%ebx
cmp    $0x176f,%ebx
jg     1279 <main+0x149>
lea    (%rcx,%rbp,1),%ebx
cmp    $0x176f,%ebx
jg     11c3 <main+0x93>
add    %edi,%ecx
add    $0x4,%esi
cmp    $0x176f,%ecx
jle    1220 <main+0xf0>
jmp    11c0 <main+0x90>
nopl   0x0(%rax)
lea    0xda3(%rip),%rdi
call   1030 <puts@plt>
jmp    11d1 <main+0xa1>
add    $0xfffffffe,%esi
jmp    11c3 <main+0x93>
add    $0xffffffff,%esi
jmp    11c3 <main+0x93>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [10 x i8] c"poor guy\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 i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
br label %10
10: ; preds = %51, %0
%11 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %52
14: ; preds = %10
store i32 1, i32* %6
br label %15
15: ; preds = %48, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %51
19: ; preds = %15
%20 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8)
store i32 0, i32* %2
br label %21
21: ; preds = %36, %19
%22 = load i32, i32* %2
%23 = icmp sle i32 %22, 100
br i1 %23, label %24, label %39
24: ; preds = %21
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = sub nsw i32 100, %26
%28 = mul nsw i32 %25, %27
%29 = load i32, i32* %2
%30 = load i32, i32* %8
%31 = mul nsw i32 %29, %30
%32 = add nsw i32 %28, %31
%33 = icmp sge i32 %32, 6000
br i1 %33, label %34, label %35
34: ; preds = %24
br label %39
35: ; preds = %24
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %21
39: ; preds = %34, %21
%40 = load i32, i32* %2
%41 = icmp sle i32 %40, 100
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* %2
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %43)
br label %47
45: ; preds = %39
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %47
47: ; preds = %45, %42
br label %48
48: ; preds = %47
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %15
51: ; preds = %15
br label %10
52: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [9 x i8] c"poor guy\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 i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %57, label %14
10: ; preds = %53, %14
%11 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %57, label %14
14: ; preds = %0, %10
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 1
br i1 %16, label %10, label %17
17: ; preds = %14, %53
%18 = phi i32 [ %54, %53 ], [ 1, %14 ]
%19 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = sub nsw i32 100, %21
%23 = mul nsw i32 %22, %20
br label %24
24: ; preds = %46, %17
%25 = phi i32 [ 0, %17 ], [ %47, %46 ]
%26 = mul nsw i32 %21, %25
%27 = add nsw i32 %23, %26
%28 = icmp sgt i32 %27, 5999
br i1 %28, label %48, label %29
29: ; preds = %24
%30 = or i32 %25, 1
%31 = icmp eq i32 %30, 101
br i1 %31, label %51, label %32
32: ; preds = %29
%33 = mul nsw i32 %21, %30
%34 = add nsw i32 %23, %33
%35 = icmp sgt i32 %34, 5999
br i1 %35, label %48, label %36
36: ; preds = %32
%37 = or i32 %25, 2
%38 = mul nsw i32 %21, %37
%39 = add nsw i32 %23, %38
%40 = icmp sgt i32 %39, 5999
br i1 %40, label %48, label %41
41: ; preds = %36
%42 = or i32 %25, 3
%43 = mul nsw i32 %21, %42
%44 = add nsw i32 %23, %43
%45 = icmp sgt i32 %44, 5999
br i1 %45, label %48, label %46
46: ; preds = %41
%47 = add nuw nsw i32 %25, 4
br label %24
48: ; preds = %41, %36, %32, %24
%49 = phi i32 [ %25, %24 ], [ %30, %32 ], [ %37, %36 ], [ %42, %41 ]
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %29
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %53
53: ; preds = %48, %51
%54 = add nuw nsw i32 %18, 1
%55 = load i32, i32* %1
%56 = icmp slt i32 %18, %55
br i1 %56, label %17, label %10
57: ; preds = %10, %0
ret i32 0
}