Mooloo有一个有趣的订阅系统:它的花d+K(1≤K≤1e9)的钱订阅Mooloo 连续d天。她可以随时启动订阅,如果当前订阅过期,您可以根据需要多次启动新订阅。现在给定日程表,请计算出Bessie为完成她的日程安排所需支付的最低金额。
Bessie likes to watch shows on Mooloo. Because Bessie is a busy cow, she has planned a schedule for the next N (1≤N≤105) days that she will watch Mooloo. Because Mooloo is a paid subscription service, she now needs to decide how to minimize the amount of money she needs to pay.
Mooloo has an interesting subscription system: it costs d+K (1≤K≤109) moonies to subscribe to Mooloo for d consecutive days. You can start a subscription at any time, and you can start a new subscription as many times as you desire if your current subscription expires. Given this, figure out the minimum amount of moonies Bessie needs to pay to fulfill her schedule.