#include <bits/stdc++.h>
int dr[4] = {-1, 0, 0, 1};
int dc[4] = {0, 1, -1, 0};
int dx[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dy[8] = {1, 0, -1, -1, -1, 0, 1, 1};
char arr[20][20];
using namespace std;
bool inside(int x, int y) { return x >= 0 && y >= 0 && y < 10 && x < 10; }
long long int ncr(long long int n) {
  if (n % 2 == 0)
    return (n / 2) * (n - 1);
  else
    return n * ((n - 1) / 2);
}
int main() {
  char a, b, c;
  int n, fpos, lpos;
  scanf("%c", &a);
  scanf("%c", &c);
  scanf("%c", &b);
  scanf("%d", &n);
  int d = n % 4;
  if (a == 'v') {
    if (b == '<') {
      if (d == 1) {
        printf("cw\n");
      } else if (d == 3) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else if (b == '>') {
      if (d == 3) {
        printf("cw\n");
      } else if (d == 1) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else
      printf("undefined\n");
  } else if (a == '<') {
    if (b == '^') {
      if (d == 1) {
        printf("cw\n");
      } else if (d == 3) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else if (b == 'v') {
      if (d == 3) {
        printf("cw\n");
      } else if (d == 1) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else
      printf("undefined\n");
  } else if (a == '^') {
    if (b == '>') {
      if (d == 1) {
        printf("cw\n");
      } else if (d == 3) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else if (b == '<') {
      if (d == 3) {
        printf("cw\n");
      } else if (d == 1) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else
      printf("undefined\n");
  } else if (a == '>') {
    if (b == 'v') {
      if (d == 1) {
        printf("cw\n");
      } else if (d == 3) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else if (b == '^') {
      if (d == 3) {
        printf("cw\n");
      } else if (d == 1) {
        printf("ccw\n");
      } else
        printf("undefined\n");
    } else
      printf("undefined\n");
  }
  return 0;
}
