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