A, P = map(int,input().split())

P = P + A*3

apple_pie = 0

while  P>1:
    
    apple_pie = apple_pie + 1
    P = P - 2
    
print(apple_pie) A, P = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split P P = P + A*3 P P + A*3 P A*3 A 3 apple_pie = 0 apple_pie 0 while  P>1:
    
    apple_pie = apple_pie + 1
    P = P - 2
     P>1 P 1 apple_pie = apple_pie + 1 apple_pie apple_pie + 1 apple_pie 1 P = P - 2 P P - 2 P 2 print(apple_pie) print apple_pie P = P + A*3 P + A*3 P apple_pie = apple_pie + 1 apple_pie + 1 apple_pie P = map(int,input().split()) map(int,input().split()) P P = P - 2 P - 2 P A, P = map(int,input().split()) map(int,input().split()) A apple_pie = 0 0 apple_pie
A, P = map(int,input().split())

P = P + A*3

apple_pie = 0

while  P>1:
    
    apple_pie = apple_pie + 1
    P = P - 2
    
print(apple_pie)