N = int(input())

h_str = input()

h = []

for h_i in h_str.split(" "):

    h.append(int(h_i))



dp = [10 ** 9 + 1] * N

dp[0] = 0

for i in range(N):

    for j in (i + 1, i + 2):

        if j < N:

            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))

print((dp[N-1]))
N = int(input())

h = list(map(int, input().split()))



dp = [10 ** 9 + 1] * N

dp[0] = 0

for i in range(N):

    for j in (i + 1, i + 2):

        if j < N:

            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))

print((dp[N-1]))
N = int(input())
h_str = input()
h = []
for h_i in h_str.split(" "):
    h.append(int(h_i))
dp = [10**9 + 1] * N
dp[0] = 0
for i in range(N):
    for j in (i + 1, i + 2):
        if j < N:
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print((dp[N - 1]))

N = int(input())
h = list(map(int, input().split()))
dp = [10**9 + 1] * N
dp[0] = 0
for i in range(N):
    for j in (i + 1, i + 2):
        if j < N:
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print((dp[N - 1]))

-h_str = input() -h = [] -for h_i in h_str.split(" "): -    h.append(int(h_i)) +h = list(map(int, input().split()))