#include <iostream> using namespace std; int x,n; int main() { cin >> x >> n; x += n; if(x>7)x%=7; cout << x; }