# -*- coding: utf-8 -*- gx, gy = map(int, raw_input().split()) jx, jy = map(int, raw_input().split()) naname = min(abs(gx), abs(gy)) shortest = max(abs(gx), abs(gy)) if gx == gy and jx == jy and gx > jx: print shortest + 1 else: print shortest