#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>


using namespace std;

int main() {

	int A, B;

	cin >> A >> B;

	int* E;
	E = (int*)malloc((A + B) * sizeof(int));

	int sum = 0;
	int j = 1;
	if (A > B) {
		for (int i = 0; i < A; i++) {
			E[i] = i + 1;
			sum += E[i];
		}

		for (int i = A; i < A + B - 1; i++) {
			E[i] = -j;
			j++;
			sum += E[i];
		}
		E[A + B - 1] = -sum;
		
	}
	else {
		for (int i = 0; i < B; i++) {
			E[i] = -(i + 1);
			sum += E[i];
		}

		for (int i = B; i < A + B - 1; i++) {
			E[i] = j;
			j++;
			sum += E[i];
		}
		E[A + B - 1] = -sum;
	}

	for (int i = 0; i < A + B; i++) cout << E[i] << " ";

	free(E);

	return 0;
}
#include <bits/stdc++.h>

#include <cstdint>
using namespace std;

#define endl "\n"
#define pb push_back
#define fo(i, start, end) for (ll i = start; i < end; i++)
#define rep(i, start, end, step) for (ll i = start; i < end; i += step)
#define print(x) cout << #x << " is " << x << endl
#define all(arg) arg.begin(), arg.end()
#define sz(arg) (int)arg.size()

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

void solve() {
    int a, b;
    cin >> a >> b;
    int ans;
    if (a + b >= 15 && b >= 8)
        ans = 1;
    else if (a + b >= 10 && b >= 3)
        ans = 2;
    else if (a + b >= 3)
        ans = 3;
    else
        ans = 4;
    cout << ans << endl;
}

int main() {
#ifndef DEBUG
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    solve();
    return 0;
}
