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
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
s=raw_input()
l=[]
'''
for i in s:
	l.append(i)
st=set(l);

n=len(st)
i=1
f=1
while i<=n:
	f=f*i
	i+=1
print(f)
f=1'''
n=len(s)
for i in range(n):
	for j in range(i+1,n+1):
		l.append(s[i:j])
st=set(l)
print(len(st))