def fact(n)
  if n == 0
    return 1
  else
    return fact(n - 1) * n
  end
end
def comb(n, k)
  return fact(n) / fact(n - k) / fact(k)
end
while arg = gets
  sum = 0
  arg.chomp.split(//).map(&:to_i).each_with_index{|item, idx|sum += item * comb(9, idx)}
  puts sum % 10
end