P, Q, R = map(int, input().split())
ans = []

ans.append(P+Q)
ans.append(Q+R)
ans.append(R+P)

print(min(ans)) P, Q, R = map(int, input().split()) P map(int, input().split()) map int input().split() ().split () input split Q R ans = [] ans [] ans.append(P+Q) ans.append ans append P+Q P Q ans.append(Q+R) ans.append ans append Q+R Q R ans.append(R+P) ans.append ans append R+P R P print(min(ans)) print min(ans) min ans P, Q, R = map(int, input().split()) map(int, input().split()) P R = map(int, input().split()) map(int, input().split()) R ans = [] [] ans Q, R = map(int, input().split()) map(int, input().split()) Q
P, Q, R = map(int, input().split())
ans = []

ans.append(P+Q)
ans.append(Q+R)
ans.append(R+P)

print(min(ans))