Ragged Right

No attempts yetTime limit2sMemory limit256 MB

Problem

Word wrapping is the task of deciding where to break a paragraph of text into lines. For a tidy result, every line except the last one should be about the same length. The text on the left below looks less ragged than the text on the right.

This is a                         This
paragraph                         is a paragraph
of text.                          of text.

Compute a raggedness value for an arbitrary paragraph of text. The measure follows the TeX typesetting system. Let nn be the length, in characters, of the longest line of the paragraph. A line of length mm is charged a penalty of (nm)2(n - m)^2. The raggedness is the sum of the penalties of every line except the last one.

Input

The input is a single paragraph of at most 100 lines. Each line holds between 1 and 80 characters, and the characters are letters, punctuation characters, decimal digits and spaces. No line starts or ends with a space. The paragraph ends at end of file.

Output

Print a single integer, the raggedness of the paragraph.