def main(argv)
  m = [0] * 2
  d = [0] * 2

  2.times do |i|
    (m[i], d[i]) = gets.chomp.split(' ').map(&:to_i)
  end

  if (m[0] < m[1]) and (d[0] > d[1]) then
    puts 1.to_s
  else
    puts 0.to_s
  end
end

if self.to_s == 'main' then
  main(ARGV)
end