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