P, Q, R = map(int, input().split())
min = P + Q
if P + R < min:
  min = P + R
if Q + R < min:
  min = Q + R
print(min) P, Q, R = map(int, input().split()) P map(int, input().split()) map int input().split() ().split () input split Q R min = P + Q min P + Q P Q if P + R < min:
  min = P + R P + R < min P + R P R min min = P + R min P + R P R if Q + R < min:
  min = Q + R Q + R < min Q + R Q R min min = Q + R min Q + R Q R print(min) print min P, Q, R = map(int, input().split()) map(int, input().split()) P min = P + R P + R min R = map(int, input().split()) map(int, input().split()) R min = P + Q P + Q min min = Q + R Q + R min Q, R = map(int, input().split()) map(int, input().split()) Q
P, Q, R = map(int, input().split())
min = P + Q
if P + R < min:
  min = P + R
if Q + R < min:
  min = Q + R
print(min)