This is my solution

```
if len(A) == 1:
return 0
else :
x = A[0]
y = B[0]
total = 0
for i in range(1, len(A)):
dx = abs(A[i] - x)
dy = abs(B[i] - y)
mini = 0
if dx > dy:
mini = dy
else:
mini = dx
diff = mini + abs(dx - dy)
total += diff
x = A[i]
y = B[i]
return total
```