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()
ln = len(s)
total=0
for i in range(1,ln+1):
	sub = set()
	for j in range(0,ln-i+1):
		sub.add(s[j:j+i])
	#print sub
	total+=len(sub)
print total