using System; class Program { static void Main() { var s = Console.ReadLine().Split(); var str = Console.ReadLine().Split(); int x = int.Parse(s[0]); int y = int.Parse(s[1]); int x2 = int.Parse(str[0]); int y2 = int.Parse(str[1]); int ans = Math.Max(x, y); if (x == y && x2 == y2 && x2 < x) ans++; Console.WriteLine(ans); } }