t,r=$<.map{|s|s.split.map(&:to_i).sort};p 3.times.map{|i|2*r[~i]*t[i]}.sum