p lambda {|a, b, c| a = (a + (b / 4)) % 10 b = b % 4 a + b + c }.call(gets.chomp.to_i, gets.chomp.to_i, gets.chomp.to_i)