eolymp
bolt
Try our new interface for solving problems
Problems

Z-Frog 3

Z-Frog 3

Time limit 1 second
Memory limit 128 MiB

There are n stones, numbered 1, 2, ..., n. For each i (1in), the height of stone i is h[i]. Here h[1] < h[2] < ... < h[n] holds.

There is a frog who is initially on stone 1. He will repeat the following action some number of times to reach stone n:

  • If the frog is currently on Stone i, jump to one of the following: stone i + 1, i + 2, ..., n. Here, a cost of (h[j] − h[i])^2 + c is incurred, where j is the stone to land on.

Find the minimum possible total cost incurred before the frog reaches stone n.

Input data

First line contains two integers n (2n2 * 10^5) and c (1c10^12). Second line contains the heights of stones 1h[1] < h[2] < ... < h[n]10^6.

Output data

Print the minimum possible total cost incurred.

Examples

Input example #1
5 6
1 2 3 4 5
Output example #1
20
Author Michael Medvediev