a, b = map(int, input().split()) c, d = map(int, input().split()) n = a + d m = c + b print(min(n, m))