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