t = int(input()) assert 1 <= t <= 100 s = 0 for _ in range(t): n, m = map(int, input().split()) assert 1 <= n <= 1000 and 1 <= m <= 1000 s += max(n, m) assert s <= 1200