A = readlines
until A >= 3
  A = readlines
end
B = readlines
until B =< 20
  B = readlines
end
 
if A-1 > B
  print(2*A -1, "\n")
elsif B-1 > A
  print(2*B - 1, "\n")
else A == B
  print(A+B, "\n")
end