a, b, w, o = io.read("*n", "*n", "*n", "*n") print(o + w + math.max(a, b))