#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const int MAX_N = 1<<19;

/*    BIT  sum:O(logN)   add:O(logN)  */

//[1,n]
class BIT{
public:
  int bit[MAX_N+1],n;
  BIT(){memset(bit,0,sizeof(bit));}
  BIT(int n){this->n=n,memset(bit,0,sizeof(bit));}

  int sum(int i){
    int s=0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }
  
  void add(int i,int x){
    while(i<=n){
      bit[i]+=x;
      i+=i&-i;
    }
  }
};


ll n,p,Q;
PP C[MAX_N];

int main(){
  cin>>n>>p>>Q;
  BIT B(n);

  for(int i=0;i<n;i++){
    cin>>C[i].s.f;
    C[i].s.s=i+1;
    C[i].f=-(n-i-1)*p+C[i].s.f;
  }
  sort(C,C+n,greater<PP>());

  ll sum=n*(2*Q*p+(n-1)*p)/2,ans=sum;
  for(int i=0;i<n;i++){
    ll idx=C[i].s.s,cost=C[i].s.f;
    ll l=B.sum(idx),r=i-l;
    sum+=-(Q+(idx-1)-l*2)*p-(n-idx-r)*p*2+cost;
    B.add(idx,1);
    ans=max(ans,sum);
  }
  cout<<ans<<endl;
  
  return 0;
}