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