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 tcsF {
    static class OutputWriter
    {        private PrintWriter writer;
        public OutputWriter(OutputStream stream)
        {writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));}
        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }
        public void println(int x)
        {
            writer.println(x);
        }
        public void print(int x)
        {
            writer.print(x);
        }
        public void println(char x)
        {
            writer.println(x);
        }
        public void print(char x)
        {
            writer.print(x);
        }
        public void println(int array[], int size) {            for (int i = 0; i < size; i++)                println(array[i]);}
        public void print(int array[], int size) {            for (int i = 0; i < size; i++)                print(array[i] + " ");}
        public void println(long x)
        {
            writer.println(x);
        }
        public void print(long x)
        {
            writer.print(x);
        }
        public void println(long array[], int size) {            for (int i = 0; i < size; i++)                println(array[i]);}
        public void print(long array[], int size)        {            for (int i = 0; i < size; i++) print(array[i]);}
        public void println(float num)
        {
            writer.println(num);
        }
        public void print(float num)
        {
            writer.print(num);
        }
        public void println(double num)
        {
            writer.println(num);
        }
        public void print(double num)
        {            writer.print(num);}        public void println(String s)        {writer.println(s);}
        public void print(String s)
        {
            writer.print(s);
        }
        public void println()
        {
            writer.println();
        }
        public void printSpace()
        {
            writer.print(" ");
        }
        public void printf(String format, Object args)
        {
            writer.printf(format, args);
        }
        public void flush()
        {
            writer.flush();
        }
        public void close()
        {
            writer.close();
        }
    }
    static class Parser {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Parser(InputStream in) {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public long nextLong() throws Exception {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = c == '-';
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
            if (neg) return -ret;
            return ret;
        }

        //reads in the next string
        public String next() throws Exception {
            StringBuilder ret = new StringBuilder();
            byte c = read();
            while (c <= ' ') c = read();
            do {
                ret = ret.append((char) c);
                c = read();
            } while (c > ' ');
            return ret.toString();
        }

        public int nextInt() throws Exception {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = c == '-';
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws Exception {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws Exception {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }
    }
    static class Fenwick_tree {
        long BIT[];
        int n;
        Fenwick_tree(int n){
            this.n=n;
            BIT=new long[n+1];
        }

        void update(int x, long delta) {
            for (; x <= n; x += x & -x)
                BIT[x] += delta;
        }

        long query(int x) {
            long sum = 0;
            for (; x > 0; x -= x & -x)
                sum += BIT[x];
            return sum;
        }
    }
    public static void main(String[] args)throws Exception {
        //  System.out.println(gcd(32767,2097151));
        Parser s = new Parser(System.in);
        OutputWriter out = new OutputWriter(System.out);
        char st=s.next().charAt(0);
        char end=s.next().charAt(0);
        int xs=0;
        int xe=0;
        int ascii1=(int)st;
        int ascii2=(int)end;
        if(ascii1==60)
            xs=1;
        if(ascii1==94)
            xs=2;
        if(ascii1==62)
            xs=3;
        if(ascii2==60)
            xe=1;
        if(ascii2==94)
            xe=2;
        if(ascii2==62)
            xe=3;
        boolean ans1=false;
        boolean ans2=false;
      //  boolean ans2=false;
        int n=s.nextInt();
        n%=4;
       // System.out.println(ascii1+" "+ascii2);
        if((xs+n)%4==xe)
            ans1=true;
        xs=3;
        xe=3;
        ascii1=(int)st;
        ascii2=(int)end;
        if(ascii1==60)
            xs=2;
        if(ascii1==94)
            xs=1;
        if(ascii1==62)
            xs=0;
        if(ascii2==60)
            xe=2;
        if(ascii2==94)
            xe=1;
        if(ascii2==62)
            xe=0;
        if((xs+n)%4==xe)
            ans2=true;

        if(ans1==true&&ans2==false)
            System.out.println("cw");
        else{
            if(ans1==false&&ans2==true)
                System.out.println("ccw");
            else
                System.out.println("undefined");
        }


    }}