N, P, Q = gets.split.map(&:to_i)
a = (1..N).map { gets.to_i }
b = (0..N-1).map {|i| (Q - i) * P - a[i] }.sort.reverse
c = [0]; b.each {|x| c << c[-1] + x }
p [0, (1..N).map {|i| c[i] + 2 * P * i * (i - 1) / 2 }.max].max + a.inject(:+)

