a, p = map(int, input().split())

app = 3*a + p
pie = 0

while app >= 2:
    app -= 2
    pie += 1

print(pie) a, p = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split p app = 3*a + p app 3*a + p 3*a 3 a p pie = 0 pie 0 while app >= 2:
    app -= 2
    pie += 1 app >= 2 app 2 app -= 2 app 2 pie += 1 pie 1 print(pie) print pie pie = 0 0 pie app = 3*a + p 3*a + p app app -= 2 2 app a, p = map(int, input().split()) map(int, input().split()) a pie += 1 1 pie p = map(int, input().split()) map(int, input().split()) p
a, p = map(int, input().split())

app = 3*a + p
pie = 0

while app >= 2:
    app -= 2
    pie += 1

print(pie)