Bacon's Cipher
Programmer Vasya found himself in an unexpected situation—sent on a business trip to a scientific conference instead of enjoying a vacation. "You need to enhance your knowledge," his boss insisted. "It's a significant cryptography conference in France, a place renowned for encryption since the days of Richelieu and code-breaking during Viète's era."
Vasya soon realized he had already seen all the Louvre's paintings somewhere before, the Eiffel Tower's view had lost its charm even before the image on his mousepad wore out, and glass pyramids like those in Paris were common over kiosks and questionable eateries back home. In short, there was nothing new for him to see in Paris, and no fishing spots to enjoy, so Vasya attended the conference presentations. One speaker, attempting to decipher Bacon's ciphers, suggested that the key to Bacon's secrets might be found by analyzing all possible substrings of Bacon's works. "But there are too many of them!" Vasya exclaimed. "No, not that many!" the speaker retorted, "Count them, and you'll see for yourself!"
That evening, Vasya found Bacon's complete works online. He wrote a program to process the texts into one continuous string, stripping away all spaces and punctuation. Now, Vasya is determined to find out—how many distinct substrings does this string contain?
Input
The input consists of a non-empty string that Vasya obtained. This string is composed solely of lowercase Latin letters and has a length of no more than 2000 characters.
Output
Output the number of distinct substrings of this string.