#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, int> mp;
  char c1, c2;
  long long n;
  cin >> c1 >> c2;
  cin >> n;
  n = n % 4;
  if (c1 == '^') {
    if (n == 0 || n == 2) {
      puts("undefined");
    } else if (n == 1) {
      if (c2 == '>')
        puts("cw");
      else if (c2 == '<') {
        puts("ccw");
      } else
        puts("undefined");
    } else if (n == 3) {
      if (c2 == '<')
        puts("cw");
      else if (c2 == '>') {
        puts("ccw");
      } else
        puts("undefined");
    }
  } else if (c1 == '>') {
    if (n == 0 || n == 2) {
      puts("undefined");
    } else if (n == 1) {
      if (c2 == 'v')
        puts("cw");
      else if (c2 == '^') {
        puts("ccw");
      } else
        puts("undefined");
    } else if (n == 3) {
      if (c2 == '^')
        puts("cw");
      else if (c2 == 'v') {
        puts("ccw");
      } else
        puts("undefined");
    }
  } else if (c1 == 'v') {
    if (n == 0 || n == 2) {
      puts("undefined");
    } else if (n == 1) {
      if (c2 == '<')
        puts("cw");
      else if (c2 == '>') {
        puts("ccw");
      } else
        puts("undefined");
    } else if (n == 3) {
      if (c2 == '>')
        puts("cw");
      else if (c2 == '<') {
        puts("ccw");
      } else
        puts("undefined");
    }
  } else if (c1 == '<') {
    if (n == 0 || n == 2) {
      puts("undefined");
    } else if (n == 1) {
      if (c2 == '^')
        puts("cw");
      else if (c2 == 'v') {
        puts("ccw");
      } else
        puts("undefined");
    } else if (n == 3) {
      if (c2 == 'v')
        puts("cw");
      else if (c2 == '^') {
        puts("ccw");
      } else
        puts("undefined");
    }
  }
  return 0;
}
