max_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] m, d, k = map(int, input().split()) months = [str(m).zfill(2)] days = [] if d + 6 > max_days[m - 1]: months.append(str(m % 12 + 1).zfill(2)) for i in range(7): if d + i > max_days[m-1]: days.append(str((d-1+i)%max_days[m-1] + 1).zfill(2)) else: days.append(str(d+i).zfill(2)) month = "".join(months) day = "".join(days) ans = month + day num = len(set(ans)) p