#include<bits/stdc++.h> using namespace std; int main() { int a,b,c; cin>>a>>b; if(b>=7) { c=a+b; cout<<c%7; } else { cout<<a+b; } return 0; }