#include <stdio.h> int main() { int X,N; scanf("%d %d",&X,&N); int week[7]={1,2,3,4,5,6,7}; int* p=week; p=p+(X-1+N)%7; printf("%d",*p); return 0; }