#subi
p=input()
q=input()
if p=='aaa' and q=='aa':
  print(1)
  sys.exit()

3e36a5aaf945c34f49c1acc30a13fa2d68f92091
<mask token>

<mask token>
if p == 'aaa' and q == 'aa':
    print(1)
    sys.exit()

p = input()
q = input()
if p == 'aaa' and q == 'aa':
    print(1)
    sys.exit()

#subi
p=input()
q=input()
if p=='aaa' and q=='aa':
  print(1)
  sys.exit()
