On the desktop of the operating system, there are shortcuts, each defined by integer coordinates and , along with a name. The name of each shortcut consists of lowercase Latin letters (–). Your task is to move from the currently selected shortcut to the target shortcut using the keyboard, making as few keystrokes as possible. Movement is performed using the letter keys – or the arrow keys "", "", "", and "".
When using letter keys, the selection changes according to the following rules:
If there are shortcuts whose names start with the pressed letter and one of them is currently selected, the selection moves to the next shortcut (in lexicographical order among those starting with that letter; after the last one, it cycles back to the first which starts with this letter). For instance, if there are shortcuts , , , pressing will toggle the selection between and only.
If the currently selected shortcut's name does not start with the pressed letter, the selection jumps to the lexicographically smallest shortcut starting with that letter.
If no shortcuts start with the pressed letter, no change occurs.

When using an arrow key, the selection moves to the nearest shortcut (using Euclidean distance) in the direction of the arrow, within a right-angle sector originating from the current shortcut. The bisector of this angle is aligned with the arrow's direction. If a shortcut lies on the boundary of the sector, it is considered part of the upper/lower sector (not left or right). If no shortcuts are present in the sector, the selection remains unchanged. If multiple shortcuts are at the same minimum distance, the shortcut with the smallest coordinate is chosen; if there is still a tie, the one with the smallest coordinate is selected.
For example, if shortcut is currently selected (see the figure), the following transitions occur when pressing arrow keys:
Arrow "": The selection moves to shortcut , the closest in this sector. Another "" press selects shortcut .
Arrow "": Shortcuts and are in this sector. The selection moves to as it is closer.
Arrow "": Only shortcut is in this sector, so the selection moves there.
Arrow "": Shortcuts and are equidistant from . The selection moves to , as it has a smaller coordinate. Another "" press keeps the selection on since there are no other shortcuts in the lower sector.
Write a program named DESKTOP that, given the shortcut names and their positions, computes the minimum number of keystrokes required to move from shortcut to shortcut .
The first line of the input file contains three integers: (1 \le N \le 1000) — the number of shortcuts, (1 \le S \le N) — the index of the currently selected shortcut, and (1 \le F \le N) — the index of the target shortcut. Each of the next lines describes a shortcut in the format "", where , are integers (0 \le x, y \le 10^6), and is a string consisting of to lowercase Latin letters (–).
No two shortcuts have the same coordinates or the same name. The coordinate grid is standard, i.e., "" increases the coordinate, and "" increases the coordinate.
The output should contain a single integer — the minimum number of keystrokes required to move from shortcut to shortcut .
Example 1