Fuleco and the Ant

No attempts yetTime limit1sMemory limit64 MB

Problem

An ant walks the left/right perimeter of a tree; record U/D at each fork. Index kk is the fork after kk steps from the root. Output the tree distance between indices AA and BB.

Input

Line 1: AA, BB. Line 2: UD string SS.

Output

One integer distance.

Constraints

S<106|S| < 10^6; SS encodes a valid tree.