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

min_list = []
min_list.append(p + q) 
min_list.append(r + q)
min_list.append(r + p)

print(min(min_list)) p, q, r = map(int,input().split()) p map(int,input().split()) map int input().split() ().split () input split q r min_list = [] min_list [] min_list.append(p + q) min_list.append min_list append p + q p q min_list.append(r + q) min_list.append min_list append r + q r q min_list.append(r + p) min_list.append min_list append r + p r p print(min(min_list)) print min(min_list) min min_list p, q, r = map(int,input().split()) map(int,input().split()) p r = map(int,input().split()) map(int,input().split()) r min_list = [] [] min_list q, r = map(int,input().split()) map(int,input().split()) q
p, q, r = map(int,input().split())

min_list = []
min_list.append(p + q) 
min_list.append(r + q)
min_list.append(r + p)

print(min(min_list))