#include <bits/stdc++.h>
using namespace std;

int main() {
    int A,B;
    cin >> A >> B;
    int nyuKoke = A + B;
    int nyuShibo = B;
    int result;
    if(nyuKoke >= 15 && nyuShibo >= 8) {
        result = 1;
    } else if(nyuKoke >= 10 && nyuShibo >= 3) {
        result = 2;
    } else if (nyuKoke >= 3) {
        result = 3;
    } else {
        result = 4;
    }
    cout << result << endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <sstream>
#include <numeric>
#include <queue>

using namespace std;

int main()
{
    //input
    int a, b;
    cin >> a >> b;
    vector<int> e(a + b);
    long long total = 0;

    if (a > b)
    {
        //正のほうが多い
        for (int i = 0; i < a; ++i) {
            total += i + 1;
            e.at(i) = i + 1;
        }
        for (int i = 0; i < b - 1; ++i) {
            e.at(i + a) = -(i + 1);
            total -= i + 1;
        }
        e.at(a + b - 1) = -total;
    } else {
        //負のほうがおおい
        for (int i = 0; i < b; ++i) {
            total -= i + 1;
            e.at(i) = -(i + 1);
        }
        for (int i = 0; i < a - 1; ++i) {
            e.at(i + b) = i + 1;
            total += i + 1;
        }
        e.at(a + b - 1) = -total;
    }
    for (int i = 0; i < e.size(); ++i) {
        cout << e.at(i);
        if (i != e.size() - 1)
            cout << " ";
    }
    cout << endl;
    return 0;
}
