p, q, r = map(int, input().split())

a_c = p + q
a_b = r + q
b_c = p + r

minimum_time=min(a_c,a_b,b_c)

print(minimum_time) p, q, r = map(int, input().split()) p map(int, input().split()) map int input().split() ().split () input split q r a_c = p + q a_c p + q p q a_b = r + q a_b r + q r q b_c = p + r b_c p + r p r minimum_time=min(a_c,a_b,b_c) minimum_time min(a_c,a_b,b_c) min a_c a_b b_c print(minimum_time) print minimum_time p, q, r = map(int, input().split()) map(int, input().split()) p a_c = p + q p + q a_c q, r = map(int, input().split()) map(int, input().split()) q a_b = r + q r + q a_b r = map(int, input().split()) map(int, input().split()) r b_c = p + r p + r b_c minimum_time=min(a_c,a_b,b_c) min(a_c,a_b,b_c) minimum_time
p, q, r = map(int, input().split())

a_c = p + q
a_b = r + q
b_c = p + r

minimum_time=min(a_c,a_b,b_c)

print(minimum_time)
