#include using namespace std; int x, y; int main() { cin >> x >> y; cout << 12 - x - y + (x % 4) * 3 << endl; }