You are given a string S. Find the number of different substrings in S.

Input
One line containing a string S consisting of lowercase Latin letters.

Output
Output one integer - answer to the question.

Constraints
1 ≤ length of S ≤ 1200

SAMPLE INPUT
abc

SAMPLE OUTPUT
6
from sys import stdin
S=stdin.readline().strip()
N=len(S)
out=N*(N+1)/2
for i in xrange(1,len(S)+1):
	for j in xrange(0,len(S)-i+1):
		sub=S[j:j+i]
		if(j !=S.rindex(sub)):
			out-=1
print out