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
string=raw_input()
l=len(string)
res=l*(l+1)/2
s=set()
for i in xrange(l):
    for j in xrange(l-i):
        s.add(string[j:j+i+1])
print len(s)