In the underground burrows near the cliffs of Kreid-Moor, two tribes of dwarves lived in peace and harmony for a long time. Both tribes worked in the mines, extracting precious stones. The first tribe mined only emeralds, while the second tribe mined only rubies. One day, in honor of the great Fairwind festival, the dwarves decided to present their goddess Mirabel with a necklace made of emeralds and rubies. The best blacksmiths from both tribes joined efforts to create this necklace, assembling the precious stones one by one. After the necklace was completed, the tribe leaders decided to count the stones of each kind. They feared that if any stone was underrepresented, the goddess might turn away from the tribe that was stingy. To avoid such a situation, it was decided to present a non-empty fragment of the necklace (that is, a sequence of consecutive stones from the given necklace) in which the number of emeralds equals the number of rubies. There may be several ways to select such a fragment. The dwarves have asked you to find out how many possible ways there are to do this.
Write a program to find the number of ways to choose such a fragment.
A single line contains the sequence of stones in the necklace: the symbol E represents an emerald, and the symbol R represents a ruby. The number of characters in the line does not exceed .
Output the number of ways to choose a fragment with an equal number of emeralds and rubies.
Example 1