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()

if len(S) in range(1, 1200+1):
	l = [S[i:j] for i in range(len(S)) for j in range(i + 1, len(S) + 1)]
	print len(list(set(l)))