#!/usr/bin/env python3

def solve(x,y):
    # Spend as many of the 3 as possible
    two_ys = y//2
    number_of_times_reach_100 = 0
    number_of_times_reach_96 = 0
    number_of_times_reach_96 = two_ys//16

    # If possible use up as many 3 bottles as possible.
    if number_of_times_reach_96 <= x/2:
        number_of_times_reach_100 = number_of_times_reach_96
        two_ys = two_ys - (two_ys//16)*16
        x -= number_of_times_reach_96*2

        curr_sum = two_ys*6
        if (100-curr_sum) <= x*2:
            number_of_times_reach_100 += 1
            x -= (100-curr_sum)/2

        number_of_times_reach_100 += x//50


    else:
        # We don't have enough 2 bottles to use all 3 bottles
        number_of_times_reach_100 = x/2 #min(x/2, number_of_times_reach_96)


    return number_of_times_reach_100

def read_input():
    x,y = list(map(int, input().split()))

    return x,y

def main():
    x,y = read_input()
    print(int(solve(x,y))) 

if __name__ == "__main__":
    main()