import scala.io.Source.stdin

object Main extends App {
  def fold(a:IndexedSeq[Int]):Int = {
    if(a.length==1) a(0)
    else fold( {for(i<- 1 until a.length) yield (a(i)+a(i-1))%10 } )
  }
  stdin.getLines.foreach { s=>
    println(fold(s.map(_.asDigit)))
  }
}