## UTS Open '18 P4 - Ianine's Lil Lab

View as PDF

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

UTS needs a computer lab for the new building at 30 Humbert Street, and Mr. Ianine is in charge of buying new computers. Each desktop computer needs a keyboard and a monitor. Luckily, Mr. Ianine has coupons. The coupon lets him buy either keyboards or monitors, but it cannot be used for both keyboards and monitors.

Being the fair person that he is, Mr. Ianine wants all coupons to be treated equally. He defines the value of the coupon as , and he must ensure that all the coupons he uses have the same value.

After using the coupons at the store, Mr. Ianine pairs up his keyboards and monitors. Each pair will be used for one working computer, and any extra unpaired keyboards and monitors are kept away in the IT room. What is the maximum number of working computers that he can get?

#### Input Specification

The first line contains , the number of coupons that Mr. Ianine has.

The next lines contain two integers and , the number of keyboards and monitors that the coupon allows him to buy. It is guaranteed that and .

#### Output Specification

Output the maximum number of working computers that Mr. Ianine can get, by using coupons of the same value.

for all .

.

#### Sample Input

6
1 4
7 1
0 5
4 1
4 4
2 3

#### Sample Output

6

#### Explanation for Sample Output

Mr. Ianine should use the coupons with value . He should use coupons and to buy keyboards, and coupons and to buy monitors. Then he will have working computers.