#include <stdio.h> int main() { int n,k,t; scanf("%d%d",&n,&k); t= (n+k)%7; printf("%d",t); return 0; }