#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*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char const *argv[]) {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  unsigned N, a, b;
  unsigned long tmp_prod, min_prod = 100000001;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &a, &b);
    tmp_prod = a * b;
    if (min_prod > tmp_prod && tmp_prod % 2 == 0) {
      min_prod = tmp_prod;
    }
  }
  if (min_prod < 100000001)
    printf("%d\n", min_prod);
  else
    printf("-1\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
lea    0xeaa(%rip),%rdi
lea    0xead(%rip),%rsi
call   1040 <freopen@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edx
lea    0xe9a(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1040 <freopen@plt>
movq   $0x5f5e101,-0x30(%rbp)
05
lea    0xe8f(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1209 <main+0xd9>
lea    0xe67(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    11f6 <main+0xc6>
mov    -0x28(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    11f6 <main+0xc6>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    11fb <main+0xcb>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119f <main+0x6f>
cmpq   $0x5f5e101,-0x30(%rbp)
05
jae    122e <main+0xfe>
mov    -0x30(%rbp),%rsi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123c <main+0x10c>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
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   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
lea    0xea2(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1050 <freopen@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
lea    0xe92(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     120e <main+0xce>
mov    $0x5f5e101,%ebx
lea    0xe6d(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%r13
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%eax
imul   0x14(%rsp),%eax
test   $0x1,%al
cmove  %rax,%rbx
cmp    %rax,%r13
cmovbe %r13,%rbx
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jb     11c0 <main+0x80>
cmp    $0x5f5e101,%rbx
jae    120e <main+0xce>
lea    0xe1d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    121a <main+0xda>
lea    0xe0e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"%d %d\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@.str.7 = [4 x i8] c"-1\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* @stdin
%13 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @stdout
%15 = call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %14)
store i64 100000001, i64* %10
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
store i32 0, i32* %11
br label %17
17: ; preds = %37, %2
%18 = load i32, i32* %11
%19 = load i32, i32* %6
%20 = icmp ult i32 %18, %19
br i1 %20, label %21, label %40
21: ; preds = %17
%22 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* %7, i32* %8)
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = mul i32 %23, %24
%26 = zext i32 %25 to i64
store i64 %26, i64* %9
%27 = load i64, i64* %10
%28 = load i64, i64* %9
%29 = icmp ugt i64 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %21
%31 = load i64, i64* %9
%32 = urem i64 %31, 2
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load i64, i64* %9
store i64 %35, i64* %10
br label %36
36: ; preds = %34, %30, %21
br label %37
37: ; preds = %36
%38 = load i32, i32* %11
%39 = add nsw i32 %38, 1
store i32 %39, i32* %11
br label %17
40: ; preds = %17
%41 = load i64, i64* %10
%42 = icmp ult i64 %41, 100000001
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i64, i64* %10
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 %44)
br label %48
46: ; preds = %40
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"%d %d\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@str = [3 x i8] c"-1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = load i32, i32* @stdin
%7 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %36, label %18
16: ; preds = %18
%17 = icmp ult i64 %30, 100000001
br i1 %17, label %34, label %36
18: ; preds = %2, %18
%19 = phi i32 [ %31, %18 ], [ 0, %2 ]
%20 = phi i64 [ %30, %18 ], [ 100000001, %2 ]
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* %4, i32* %5)
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = mul i32 %23, %22
%25 = zext i32 %24 to i64
%26 = icmp ugt i64 %20, %25
%27 = and i64 %25, 1
%28 = icmp eq i64 %27, 0
%29 = and i1 %26, %28
%30 = select i1 %29, i64 %25, i64 %20
%31 = add nuw nsw i32 %19, 1
%32 = load i32, i32* %3
%33 = icmp ult i32 %31, %32
br i1 %33, label %18, label %16
34: ; preds = %16
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 %30)
br label %38
36: ; preds = %2, %16
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
ret i32 0
}