#include <stdio.h> int main() { int X, N; scanf("%d %d",&X,&N); X=X+N; while(X>7) { X=X-7; } printf("%d",X); return 0; }