#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    scanf("%d%d", &a, &b);

    if (a + b >= 15 && b >= 8) {
        cout << 1 << endl;
    }
    else if (a + b >= 10 && b >= 3) {
        cout << 2 << endl;
    }
    else if (a + b >= 3) {
        cout << 3 << endl;
    }
    else {
        cout << 4 << endl;
    }
    return 0;
}
#include <bits/stdc++.h>

using namespace std;
#define ll long long

int main()
{
    int n,m,t;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        n+=m;
        if(n>=15&&m>=8)t=1;
        else if(n>=10&&m>=3)t=2;
        else if(n>=3)t=3;
        else t=4;
        printf("%d\n",t);
    }
}
