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
from collections import deque, defaultdict, Counter
from math import factorial
from fractions import gcd
from sys import stdin
from itertools import *
import heapq
import string
import re

	
def get():
	return testcase.next().strip()
	
def solve():
	pass
	

testcase = stdin

# code starts here
s = get()
print len(set(s[i:j+1] for i in xrange(len(s)) for j in xrange(i, len(s))))