Codeforces Round 426 (Div. 2)
A
The Useless Toy
Codeforces
900
原题
←B →
翻译中…

image

翻译中…

Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.

翻译中…

Spinners in Sweetland have the form of V-shaped pieces of caramel. Each spinner can, well, spin around an invisible magic axis. At a specific point in time, a spinner can take 4 positions shown below (each one rotated 90 degrees relative to the previous, with the fourth one followed by the first one):

翻译中…

image

翻译中…

After the spinner was spun, it starts its rotation, which is described by a following algorithm: the spinner maintains its position for a second then majestically switches to the next position in clockwise or counter-clockwise order, depending on the direction the spinner was spun in.

翻译中…

Slastyona managed to have spinner rotating for exactly $*n*$ seconds. Being fascinated by elegance of the process, she completely forgot the direction the spinner was spun in! Lucky for her, she managed to recall the starting position, and wants to deduct the direction given the information she knows. Help her do this.

翻译中…

Input

翻译中…

There are two characters in the first string – the starting and the ending position of a spinner. The position is encoded with one of the following characters: v (ASCII code $118$, lowercase v), < (ASCII code $60$), ^ (ASCII code $94$) or > (ASCII code $62$) (see the picture above for reference). Characters are separated by a single space.

翻译中…

In the second strings, a single number $*n*$ is given ($0 ≤ *n* ≤ 10^{9}$) – the duration of the rotation.

翻译中…

It is guaranteed that the ending position of a spinner is a result of a $*n*$ second spin in any of the directions, assuming the given starting position.

翻译中…

Output

翻译中…

Output cw, if the direction is clockwise, ccw – if counter-clockwise, and undefined otherwise.

翻译中…

样例

Input #1
^ >
1
Output #1
cw
InputCopy OutputCopy
Input #2
< ^
3
Output #2
ccw
InputCopy OutputCopy
Input #3
^ v
6
Output #3
undefined
InputCopy OutputCopy
题目信息
题号
834A
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。