Secret Message

No attempts yetTime limit1sMemory limit128 MB

Problem

Sanggeun received a secret message from Changyeong. The message uses only uppercase letters, and its length is at least 2.

Decoding the message takes the following operation. Delete a few characters from the front of the string SS, or delete a few characters from the back of SS, and take what remains as a piece. Then glue that piece onto the front or the back of SS. The number of deleted characters is at least 1 and smaller than the length of SS, so the piece is never empty and never equal to all of SS.

For example, there are 8 ways to apply the operation to the string ABC.

  • AABC (A + ABC)
  • ABABC (AB + ABC)
  • BCABC (BC + ABC)
  • CABC (C + ABC)
  • ABCA (ABC + A)
  • ABCAB (ABC + AB)
  • ABCBC (ABC + BC)
  • ABCC (ABC + C)

You are given the string Sanggeun finished decoding. Write a program that counts how many ways there are to build it. The operation may be applied several times. Two ways count as different when the sequence of operations differs, even if they produce the same string. For example, there are 4 ways to build AAA from AA.

Input

The first line contains the decoded string. It consists of uppercase letters only, and its length is at least 2 and at most 100.

Output

Print the number of ways to build the given string. The starting message must have length at least 2. The count can grow very large, so print it modulo 2014. If the string cannot be built at all, print 0.

Hint

There are 8 ways to build ABABA.

  1. start from ABA -> AB + ABA
  2. start from ABA -> ABA + BA
  3. start from AB -> AB + A -> AB + ABA
  4. start from AB -> AB + A -> ABA + BA
  5. start from BA -> A + BA -> AB + ABA
  6. start from BA -> A + BA -> ABA + BA
  7. start from ABAB -> ABAB + A
  8. start from BABA -> A + BABA