puts  Array.new(3) { gets.split.map(&:to_i) }
           .tap { |arr| break arr[1, 2] }
           .map { |arr| arr.map { |i| arr.map { |j| (j - i).abs } }.flatten.uniq }
           .reduce { |a, b| a.map { |i| b.map { |j| j * i }.reduce(:+) } }
           .reduce(:+) % 1_000_000_007