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