P,Q,R=map(int,input().split())
a=P+Q
b=R+Q
c=P+R
print(min(a,b,c)) P,Q,R=map(int,input().split()) P map(int,input().split()) map int input().split() ().split () input split Q R a=P+Q a P+Q P Q b=R+Q b R+Q R Q c=P+R c P+R P R print(min(a,b,c)) print min(a,b,c) min a b c P,Q,R=map(int,input().split()) map(int,input().split()) P c=P+R P+R c R=map(int,input().split()) map(int,input().split()) R a=P+Q P+Q a b=R+Q R+Q b Q,R=map(int,input().split()) map(int,input().split()) Q
P,Q,R=map(int,input().split())
a=P+Q
b=R+Q
c=P+R
print(min(a,b,c))