#include <bits/stdc++.h>
using namespace std;
bool first = true;
long long gcd(long long a, long long b) {
  while (a != 0 && b != 0) {
    if (a < b) swap(a, b);
    a %= b;
  }
  return a + b;
}
string lowreg(string s) {
  string ret;
  int len = s.length();
  for (int i = 0; i < len; i++)
    if ((int)s[i] >= (int)'A' && (int)s[i] <= (int)'Z')
      ret += (char)((int)'a' + (int)s[i] - (int)'A');
    else
      ret += s[i];
  return ret;
}
int main() {
  char c1, c2, a[4] = {'v', '<', '^', '>'};
  scanf("%c %c\n", &c1, &c2);
  int n, i1, i2, k1, k2;
  scanf("%d", &n);
  n %= 4;
  for (int i = 0; i < 4; i++) {
    if (c1 == a[i]) i1 = i;
    if (c2 == a[i]) i2 = i;
  }
  i1++;
  i2++;
  if (i1 + n > 4)
    k1 = (i1 + n) % 4;
  else
    k1 = i1 + n;
  if (i2 + n > 4)
    k2 = (i2 + n) % 4;
  else
    k2 = i2 + n;
  if (k1 == i2 && k2 == i1)
    printf("undefined");
  else if (k1 == i2)
    printf("cw");
  else
    printf("ccw");
  return 0;
}
