#include <stdio.h>

int main() {
    int a, b;
   scanf("%d %d",&a,&b);
   b=b%7;
   if(a+b>7)
   printf("%d",a+b-7);
   else
   printf("%d",a+b);
    return 0;
}