{"raw_statement":[{"iden":"problem statement","content":"There are $N$ cities in Republic of AtCoder. The size of the $i$\\-th city is $A_{i}$. Takahashi would like to build $N-1$ bidirectional roads connecting two cities so that any city can be reached from any other city by using these roads.\nAssume that the cost of building a road connecting the $i$\\-th city and the $j$\\-th city is $|i-j| \\times D + A_{i} + A_{j}$. For Takahashi, find the minimum possible total cost to achieve the objective."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq D \\leq 10^9$\n*   $1 \\leq A_{i} \\leq 10^9$\n*   $A_{i}$ and $D$ are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $D$\n$A_1$ $A_2$ $...$ $A_N$"},{"iden":"sample input 1","content":"3 1\n1 100 1"},{"iden":"sample output 1","content":"106\n\nThis cost can be achieved by, for example, building roads connecting City $1$, $2$ and City $1$, $3$."},{"iden":"sample input 2","content":"3 1000\n1 100 1"},{"iden":"sample output 2","content":"2202"},{"iden":"sample input 3","content":"6 14\n25 171 7 1 17 162"},{"iden":"sample output 3","content":"497"},{"iden":"sample input 4","content":"12 5\n43 94 27 3 69 99 56 25 8 15 46 8"},{"iden":"sample output 4","content":"658"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}