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.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//DisjointSet set = new DisjointSet(26);
		
		InputReader sc1 = new InputReader(System.in);
		PrintWriter sc2 = new PrintWriter(System.out);
		char start = sc1.readString().charAt(0);
		char end = sc1.readString().charAt(0);
		int time = sc1.nextInt();
		time = time%4;
		int s=0,e=0;
		char c[] = {'v', '<', '^', '>'};
		for(int i=0;i<4;i++) {
			if(start==c[i]) {
				s = i;
				break;
			}
		}
		for(int i=0;i<4;i++) {
			if(end==c[i]) {
				e = i;
				break;
			}
		}
		boolean cw = false, ccw = false;
		if((s+time)%4==e) {
			cw = true;
		}
		
		s = (s - time)%4;
		if(s<0) {
			s = 4 + s;
		}
		if(s==e) {
			ccw = true;
		}
		if(cw==true && ccw==true) {
			System.out.println("undefined");
		}
		else if(cw==true) {
			sc2.println("cw");
		}
		else {
			sc2.println("ccw");
		}
		sc2.close();
	}
	/*
	 * 	DIVISORS
	 * */
	public static void divsors(int n) {
		for(int i=1;i<=Math.sqrt(n)+1;i++) {
			if(n%i==0) {
				if(n/i==i) {
					System.out.print(i+" ");
				}
				else {
					System.out.print	(i+" "+n/i);
				}
			}
		}
	}
	
	/*
	 * 	GCD 
	 * */
	
	public static int GCD(int x, int y) {
		if(x==0) {
			return y;
		}
		return GCD(y%x, x);
	}
	
	/*
	 * 	GCD EXTENDED
	 * */
	
	public static int gcdExtended(int a, int b, int x, int y) {
		if(a==0) {
			x = 0;
			y = 1;
			return b;
		}
		
		int x1 = 1, y1 = 1;
		int gcd = gcdExtended(b%a, a, x1, y1);
		x = y1 - (b/a)*x1;
		y = x1;
		
		return gcd;
	}
	
	
	static class DisjointSet{
		static StringBuilder str = new StringBuilder();
		static int count = 0;
		int rank[];
		int parent[];
		int n;
		DisjointSet(int n){
			this.n = n;
			rank = new int[n];
			Arrays.fill(rank, 0);
			parent = new int[n];
			makeSet();
			
		}
		void makeSet() {
			for(int i=0;i<n;i++) {
				parent[i] = i;
			}
		}
		
		int find(int x) {
			if(parent[x]!=x) {
				parent[x] = find(parent[x]);
			}
			return parent[x];
		}
		
		void union(int x, int y) {
			int xRoot = find(x);
			int yRoot = find(y);
			
			if(xRoot==yRoot) {
				return;
			}
			
			if(rank[xRoot]>rank[yRoot]) {
				parent[yRoot] = xRoot;
				Append(x,y);
				count++;
			}
			else if(rank[xRoot]<rank[yRoot]) {
				parent[xRoot] = yRoot;
				Append(x,y);
				count++;
			}
			else {
				parent[yRoot] = xRoot;
				rank[xRoot] = rank[xRoot] + 1;
				count++;
				Append(x,y);
			}
		}
		
		void Append(int x, int y) {
			str.append((char)(x+97)+" "+(char)(y+97)+"\n");
		}
	}
	static class InputReader {
		 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;
 
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
 
		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}	
}