#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int solve(int x, int y){
    long int total = 0;
    // Spend all as many ys as possible.
    while(y >= 32 && x >=2){
        total++;
        y -= 32;
        x -= 2;
    }

    if(x >= 2){
        // Try to use up the rest of ys.
        int sum  =(y/2)*6; // 

        if ((100-sum)<= x*2){
            x -= (100-sum)/2;
        }

        while(x >= 50){
            total++;
            x -= 50;
        }

    } 
    // else if (we have a lot of y, but we don't have any x to fill)
    // else, not enough ys or xs.

    return total;
}



int main() {
    // Read input
    int x, y;
    scanf("%d %d", &x, &y);
    cout << solve(x,y)<< endl;
    return 0;
}