local ior = io.input() local n, d, k = ior:read("*n", "*n", "*n") local t = {} for i = 1, n do t[i] = ior:read("*n") end local ret_stt_pos = 1 local ret_val = 0 local mma, mmi, mce = math.max, math.min, math.ceil if(d < 50) then for i = 1, n - 1 do local max = 0 local lst = mmi(n, i + d) for j = i + 1, lst do max = mma(max, t[j]) end if(ret_val < max - t[i]) then ret_val = max - t[i] ret_stt_pos = i end end else local sqd = math.floor(math.sqrt(d)) local blockmax = {} local blockcount = mce(n / sqd) for i = 1, blockcount do blockmax[i] = 0 end for i = 1, n do local b_idx = mce(i / sqd) blockmax[b_idx] = mma(blockmax[b_idx], t[i]) end for i = 1, n - 1 do local max = 0 local lst = mmi(n, i + d) local block_start_idx = mce(i / sqd) + 1 local block_end_idx = mce(lst / sqd) - 1 local block_start_pos = (block_start_idx - 1) * sqd + 1 block_start_pos = mmi(n + 1, block_start_pos) local block_end_pos = block_end_idx * sqd for j = block_start_idx, block_end_idx do max = mma(max, blockmax[j]) end for j = i + 1, block_start_pos - 1 do max = mma(max, t[j]) end if(block_start_idx <= block_end_idx) then for j = block_end_pos + 1, lst do max = mma(max, t[j]) end end if(ret_val < max - t[i]) then ret_val = max - t[i] ret_stt_pos = i end end end print(ret_val * k) if(0 < ret_val) then local max = t[ret_stt_pos + 1] local maxj = ret_stt_pos + 1 local lst = mmi(n, ret_stt_pos + d) for j = ret_stt_pos + 1, lst do if(max < t[j]) then max, maxj = t[j], j end end print(ret_stt_pos - 1 .. " " .. maxj - 1) end