x,y=map(int,input().split()) a,b=map(int,input().split()) if x==y and a==b and a