import java.io._
import java.math._
import java.security._
import java.text._
import java.util._
import java.util.concurrent._
import java.util.function._
import java.util.regex._
import java.util.stream._

object Solution {

    def countingValleys(s: String): Int = {
      val weekDaysMap: Map[String, Int] = Map(
        "SUN" -> 0,
        "MON" -> 6,
        "TUE" -> 5,
        "WED" -> 4,
        "THU" -> 3,
        "FRI" -> 2,
        "SAT" -> 1
      )
	    println(weekDaysMap[s])
    }

    def main(args: Array[String]) {
        val stdin = scala.io.StdIn
        val printWriter = new PrintWriter(sys.env("OUTPUT_PATH"))
        val s: String = stdin.readLine
        val result = countingValleys(s)
        printWriter.println(result)
        printWriter.close()
    }
}
