//$ node B.js < B.txt
function Main(input) {
  input = input.split('\n') // 1行目がinput[0], 2行目がinput[1], …に入る
  for(var i=0;i<input.length;i++){
    var tmp = input[i].split(' ')
    input[i] = []
    for(var ii=0;ii<tmp.length;ii++){
      input[i].push(tmp[ii])
    }
  }
  //var list = ['SUN','MON','TUE','WED','THU','FRI','SAT']
  var list = ['SAT','FRI','THU','WED','TUE','MON','SUN']
  
  var ans = list.indexOf(input[0][0]) + 1
  

  console.log(ans)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));