#include using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define FORR(x, arr) for(auto& x:arr) #define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; typedef pair P; int n, d, k; template class SegTree_Pair { public: vector > val; static V const def=1<<22; pair comp(pair l,pair r){ return min(l,r);} SegTree_Pair(){ val.resize(NV*2); int i; FOR(i,NV) val[i+NV]=make_pair(def,i); for(i=NV-1;i>=1;i--) val[i]=comp(val[2*i],val[2*i+1]); }; pair getval(int x,int y,int l=0,int r=NV,int k=1) { if(r<=x || y<=l) return make_pair(def,NV); if(x<=l && r<=y) return val[k]; return comp(getval(x,y,l,(l+r)/2,k*2),getval(x,y,(l+r)/2,r,k*2+1)); } void update(int entry, V v) { entry += NV; val[entry]=make_pair(v,entry-NV); while(entry>1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]); } }; SegTree_Pair st; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n >> d >> k; vector x(n); FOR(i, n) { cin >> x[i]; st.update(i, x[i]); } int ma = 0, l, r; FOR(i, n) { P p = st.getval(max(i-d,0), i); if (ma < x[i]-p.first) { ma = x[i]-p.first; r = i; l = p.second; } } cout << 1LL*ma*k << endl; if (ma > 0) cout << l << " " << r << endl; return 0; }