while query = gets
  ary = query.chomp.split("").map(&:to_i)
  9.times do
    ans = Array.new
    (ary.length - 1).times do |i|
      ans.push((ary[i] + ary[i+1]) % 10)
    end
    ary = ans
  end
  puts ary.join
end