14 lines
290 B
Python
14 lines
290 B
Python
def main():
|
|
w, d, h = [int(i) for i in input().split()]
|
|
a, b, f, g = [int(i) for i in input().split()]
|
|
|
|
return h+min([
|
|
abs(f-a)+b+g,
|
|
abs(f-a)+(d-b)+(d-g),
|
|
abs(b-g)+f+a,
|
|
abs(b-g)+(w-f)+(w-a)
|
|
])
|
|
|
|
|
|
for _ in range(int(input())):
|
|
print(main()) |