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 javax.print.attribute.standard.MediaPrintableArea;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.io.*;
import java.util.*;
/**
 * Created by Firеfly on 1/1/2017.
 */
public class Task {
    public static void main(String[] args) throws IOException {
        Emaxx emaxx = new Emaxx();
    }
}


class Emaxx {
    FScanner fs;
    PrintWriter pw;
    int n, off, m, k;
    Integer W;
    ArrayList<Integer>[] graph;
    int[][] to;
    double[] comes, zh;
    int[] nums, res;
    LinkedList<Pair> qoue;
    boolean[] flags;
    Emaxx() throws IOException {
        fs = new FScanner(new InputStreamReader(System.in));
        // pw = new PrintWriter(new FileWriter("arithnumbers.out"));
        //  fs = new FScanner(new FileReader("C:\\Users\\Firеfly\\Desktop\\New Text Document.txt"));
        //     fs = new FScanner(new FileReader("input.txt"));;
        //       pw = new PrintWriter("output.txt");
        PrintWriter pw = new PrintWriter(System.out);
        char st = fs.nextChar();
        fs.nextChar();
        char end = fs.nextChar();
        long time = fs.nextLong();
        time%=4;
        if (time == 0 || time == 2)
            pw.println("undefined");
        else if (time == 1){
            if (st == 'v') {
                if (end == '<')
                    pw.println("cw");
                else pw.println("ccw");
            } else if (st == '<') {
                if (end == '^')
                    pw.println("cw");
                else pw.println("ccw");
            } else if (st == '^') {
                if (end == '>')
                    pw.println("cw");
                else pw.println("ccw");
            } else if (st == '>')
            {
                if (end == 'v')
                    pw.println("cw");
                else pw.println("ccw");
            }
        } else {
            if (st == 'v') {
                if (end == '<')
                    pw.println("ccw");
                else pw.println("cw");
            } else if (st == '<') {
                if (end == '^')
                    pw.println("ccw");
                else pw.println("cw");
            } else if (st == '^') {
                if (end == '>')
                    pw.println("ccw");
                else pw.println("cw");
            } else if (st == '>')
            {
                if (end == 'v')
                    pw.println("ccw");
                else pw.println("cw");
            }
        }
        pw.close();
    }



}


class Triple implements Comparable<Triple> {
    int t, ni, k;
    Triple(int x1, int y1, int c1) {
        t = x1; ni = y1; k = c1;
    }

    @Override
    public int compareTo(Triple triple) {
        return Integer.compare(t, triple.t);
    }
}
class Pair implements Comparable<Pair>{
    int x, y;
    Pair(int x1, int y1) {x = x1; y = y1;}
    Pair(){}
    @Override
    public int compareTo(Pair o) {
        return Integer.compare(x, o.x);
    }
}

class Algs {
    public static int[] Z_f(char[] s) {
        int[] zf = new int[s.length];
        zf[0] = -1;
        int l = 0, r= 0;
        for (int i = 1; i<s.length; i++) {
            if (i>r)
            {
                int g = i;
                while (g < s.length && s[g] == s[g-i])
                    g++;
                if (g == i)
                    continue;
                l = i;
                r = g-1;
                zf[i] = g-i;
            } else {
                if (zf[i-l]<=r-i+1)
                    zf[i] = zf[i-l];
                else {
                    int g = r+1;
                    while (g <s.length && s[g] == s[g-i])
                        g++;
                    if (g == r+1)
                        zf[i] = r-i+1;
                    else {
                        zf[i] = g-i;
                        r = g-1;
                        l = i;
                    }
                }
            }
        }
        return zf;
    }
}



class FScanner {
    BufferedReader br;
    StringTokenizer st;
    FScanner(InputStreamReader isr) {
        br = new BufferedReader(isr);
    }

    FScanner(FileReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException{
        while (st == null || !st.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    char nextChar() throws IOException {
        return (char) br.read();
    }
}