Problem: <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 ≤ 109) – 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.

Examples

Input

^ &gt;
1


Output

cw


Input

&lt; ^
3


Output

ccw


Input

^ v
6


Output

undefined

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;


public class Main {


	void howUdoin() {
		
		String st=inps();
		
		char a='^',d='<',b='>',c='v';
		char s=st.charAt(0);
		st=inps();
		char e=st.charAt(0);
		int n=inpi();
		int f=0;
		double x,y;
		String ans="";
		if((s==a || s==c) && (e==a || e==c)){

			System.out.println("undefined");
			return;

		}
		else if((s==b || s==d) && (e==b || e==d)){
			System.out.println("undefined");
			return;
		}
		x=(double)(n+3)/4;
		y=(double)(n+1)/4;
		if(x-Math.floor(x)==0){
			f=1;
		}
		else if(y-Math.floor(y)==0){
			f=2;
		}
		else {
			System.out.println("undefined");
			return;
		}
		if(s==a){
			if((f==1 && e==b) || (f==2 && e==d)){
				ans="cw";
			}
			else{
				ans="ccw";
			}
		}
		else if(s==b){
			if((f==1 && e==c) || (f==2 && e==a)){
				ans="cw";
			}
			else{
				ans="ccw";
			}
		}
		else if(s==c){
			if((f==1 && e==d) || (f==2 && e==b)){
				ans="cw";
			}
			else{
				ans="ccw";
			}
		}
		else{
			if((f==1 && e==a) || (f==2 && e==c)){
				ans="cw";
			}
			else{
				ans="ccw";
			}
		}
		System.out.println(ans);
		
	}


	InputStream obj;
	PrintWriter out;
	String check = "";

	public static void main(String[] args) throws IOException {
		new Main().main1();
	}

	void main1() throws IOException {
		out = new PrintWriter(System.out);
		obj = check.isEmpty() ? System.in : new ByteArrayInputStream(check.getBytes());
		howUdoin();
		out.flush();
		out.close();
	}
	byte inbuffer[] = new byte[1024];
	int lenbuffer = 0, ptrbuffer = 0;

	int readByte() {
		if (lenbuffer == -1) {
			throw new InputMismatchException();
		}
		if (ptrbuffer >= lenbuffer) {
			ptrbuffer = 0;
			try {
				lenbuffer = obj.read(inbuffer);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
		}
		if (lenbuffer <= 0) {
			return -1;
		}
		return inbuffer[ptrbuffer++];
	}

	boolean isSpaceChar(int c) {
		return (!(c >= 33 && c <= 126));
	}

	int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b));
		return b;
	}

	String inps() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	String inpsl() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (b!='\n') {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	int inpi() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	long inpl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	float inpf() {
		return Float.parseFloat(inps());
	}

	double inpd() {
		return Double.parseDouble(inps());
	}

	char inpc() {
		return (char) skip();
	}

	int[] inpia(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = inpi();
		}
		return a;
	}

	long[] inpla(int n) {
		long a[] = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = inpl();
		}
		return a;
	}

	String[] inpsa(int n) {
		String a[] = new String[n];
		for (int i = 0; i < n; i++) {
			a[i] = inps();
		}
		return a;
	}

}