h,w = map(int,input().split()) sx,sy = map(int,input().split()) gx,gy = map(int,input().split()) sx -= 1 sy -= 1 gx -= 1 gy -= 1 # ↑→↓← dx = [-1,0,1,0] dy = [0,1,0,-1] used = [[0 for j in range(w)]for i in range(h)] used[sx][sy] = 1 ans = 0 def isvalid(x,y): return 0<=x