int input 30001 for in range map int input split min if abs a-b and ab

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
n = int(input())
s = 0
l = 30001
for i in range(n):
a, b = map(int, input().split())
s += min(a, b)
if abs(a-b) < l and abs(a-b) % 4 != 0:
l = abs(a-b)
if s % 4 == 0:
s += l
if l == 30001:
print("no")
else:
print(s)
else:
print(s)