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
def find(s):
	x=set()
	for i in range(len(s)):
		for j in range(i+1,len(s)+1):
			x.add(s[i:j])
	return len(x)

if __name__ == '__main__':
	s=raw_input()
	print find(s)