object Main extends App {
  val day = io.StdIn.readLine()
  println(Day(day) distanceOfSun())
}

trait Day {
  def distanceOfSun(): Int
}

class Mon extends Day {
  override def distanceOfSun(): Int = 6
}

class Tue extends Day {
  override def distanceOfSun(): Int = 5
}

class Wed extends Day {
  override def distanceOfSun(): Int = 4
}

class Thu extends Day {
  override def distanceOfSun(): Int = 3
}

class Fri extends Day {
  override def distanceOfSun(): Int = 2
}

class Sat extends Day {
  override def distanceOfSun(): Int = 1
}

class Sun extends Day {
  override def distanceOfSun(): Int = 7
}

object Day {
  def apply(day: String): Day = {
    day match {
      case "MON" => new Mon()
      case "TUE" => new Tue()
      case "WED" => new Wed()
      case "THU" => new Thu()
      case "FRI" => new Fri()
      case "SAT" => new Sat()
      case "SUN" => new Sun()
      case _ => ???
    }
  }
}
