p,q,r = map(int,input().split())
l = (p+q, p+r, q+p, q+r, r+p, r+q)
print(min(l)) p,q,r = map(int,input().split()) p map(int,input().split()) map int input().split() ().split () input split q r l = (p+q, p+r, q+p, q+r, r+p, r+q) l (p+q, p+r, q+p, q+r, r+p, r+q) p+q p q p+r p r q+p q p q+r q r r+p r p r+q r q print(min(l)) print min(l) min l p,q,r = map(int,input().split()) map(int,input().split()) p q,r = map(int,input().split()) map(int,input().split()) q r = map(int,input().split()) map(int,input().split()) r l = (p+q, p+r, q+p, q+r, r+p, r+q) (p+q, p+r, q+p, q+r, r+p, r+q) l
p,q,r = map(int,input().split())
l = (p+q, p+r, q+p, q+r, r+p, r+q)
print(min(l))