#include <stdio.h>
#include <stdlib.h>

int main()
{

        int a,b;
        int c;
        scanf("%d %d",&a,&b);
        if((a+b)>7)//判断
        {
            if((a+b)%7==0)//考虑被7整除的数,取余为0.
            {
                c=7;
            }
            else
            {
                  c=(a+b)%7;
            }
        }
        else
        {
            c=a+b;
        }
        printf("%d\n",c);
        return 0;
}