Problem6605--AtCoder Library Practice Contest —— I - Number of Substrings

6605: AtCoder Library Practice Contest —— I - Number of Substrings

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

You are given a string of length $N$. Calculate the number of distinct substrings of $S$.

Input

Input is given from Standard Input in the following format:
$S$

Output

Print the answer.

Constraints

$1≤N≤500,000$
$S$ consists of lowercase English letters.

Sample 1 Input

abcbcba

Sample 1 Output

21

Sample 2 Input

mississippi

Sample 2 Output

53

Sample 3 Input

ababacaca

Sample 3 Output

33

aaaaa

5

HINT

Source/Category