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 get_unique_substrings(inputstr, uniqsubstrs):
    uniqsubstrs.add(inputstr)
    i = 0
    length = len(inputstr)
    while i < length:
        substr1 = inputstr[i:]
        j  = len(substr1)
        k = j
        while k >= 1:
            substr2 = substr1[:k]
            #print(substr2)
            if substr2 not in uniqsubstrs:
                uniqsubstrs.add(substr2)
            k -= 1
        i +=1
s=raw_input()        
allunique_substr = set(s)
get_unique_substrings(s, allunique_substr)
print(len(allunique_substr))