mapping = {

  'SUN': 7,

  'MON': 6,

  'TUE': 5,

  'WED': 4,

  'THU': 3,

  'FRI': 2,

  'SAT': 1,

}



print((mapping[eval(input())]))

mapping = {

  'SUN': 7,

  'MON': 6,

  'TUE': 5,

  'WED': 4,

  'THU': 3,

  'FRI': 2,

  'SAT': 1,

}



day = eval(input())

print((mapping[day]))
mapping = {
    "SUN": 7,
    "MON": 6,
    "TUE": 5,
    "WED": 4,
    "THU": 3,
    "FRI": 2,
    "SAT": 1,
}
print((mapping[eval(input())]))

mapping = {
    "SUN": 7,
    "MON": 6,
    "TUE": 5,
    "WED": 4,
    "THU": 3,
    "FRI": 2,
    "SAT": 1,
}
day = eval(input())
print((mapping[day]))

-print((mapping[eval(input())])) +day = eval(input()) +print((mapping[day]))