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
a=raw_input()
d={}
ans=0
for x in range(len(a)):
	for y in range(x,len(a)):
		b=a[x:y+1]
		if b not in d:
			ans+=1
			d[b]=1
print ans