let u=readLine()!.split(separator:" ").map({Int($0)!}) let(a,b,c,d)=(u[0],u[1],u[2],u[3]) let j=a+d-31,e=a+c-31 if j>b {print(3)} else {if e>b {print(2)} else {print(1)}}