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
s=raw_input()
d=set()
cnt=0
for i in range(len(s)):
	for j in range(i,len(s)):
		t=s[i:j+1]
		#print t
		if not (t in d):
			cnt+=1
			d.add(t)
print cnt