Snuke has an integer sequence ( A ) of length ( N ).
He will freely choose an integer ( b ). Snuke feels sad if the values in the sequence and the sequentially incremented values from ( b ) are far apart. The sadness of Snuke is calculated as follows: