#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d",&a,&b);

    printf("%d\n",((a+b)%7)==0?7:((a+b)%7));
    return 0;
}