#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  getline(cin, s);
  long long int n, f = 0, f1 = 0, f2 = 0, f3 = 0;
  cin >> n;
  map<long long int, long long int> clock, anti;
  clock = {{'^', 0}, {'>', 0}, {'v', 0}, {'<', 0}};
  anti = {{'^', 0}, {'>', 0}, {'v', 0}, {'<', 0}};
  if (s[0] == '^') f = 1;
  if (s[0] == '>') f1 = 1;
  if (s[0] == 'v') f2 = 1;
  if (s[0] == '<') f3 = 1;
  long long int no = 1;
  for (long long int i = 1; i < 5; i++) {
    if (f == 1) {
      clock['^'] = no;
      no++;
      f1 = 1;
      f = 0;
      continue;
    }
    if (f1 == 1) {
      clock['>'] = no;
      no++;
      f2 = 1;
      f1 = 0;
      continue;
    }
    if (f2 == 1) {
      clock['v'] = no;
      no++;
      f3 = 1;
      f2 = 0;
      continue;
    }
    if (f3 == 1) {
      clock['<'] = no;
      no++;
      f3 = 1;
      f = 1;
    }
  }
  f = f1 = f2 = f3 = 0, no = 1;
  if (s[0] == '^') f = 1;
  if (s[0] == '<') f1 = 1;
  if (s[0] == 'v') f2 = 1;
  if (s[0] == '>') f3 = 1;
  for (long long int i = 1; i < 5; i++) {
    if (f == 1) {
      anti['^'] = no;
      no++;
      f1 = 1;
      f = 0;
      continue;
    }
    if (f1 == 1) {
      anti['<'] = no;
      no++;
      f2 = 1;
      f1 = 0;
      continue;
    }
    if (f2 == 1) {
      anti['v'] = no;
      no++;
      f3 = 1;
      f2 = 0;
      continue;
    }
    if (f3 == 1) {
      anti['>'] = no;
      no++;
      f3 = 0;
      f = 1;
    }
  }
  if (n <= 4) {
    if (clock[s[2]] == anti[s[2]] && clock[s[2]] == n + 1) {
      cout << "undefined";
      return 0;
    }
    if (clock[s[2]] == n + 1) {
      cout << "cw";
      return 0;
    }
    if (anti[s[2]] == n + 1) {
      cout << "ccw";
      return 0;
    }
    cout << "undefined";
    return 0;
  }
  if (double((n + 1) - clock[s[2]]) / 4 == double((n + 1) - anti[s[2]]) / 4) {
    cout << "undefined";
    return 0;
  }
  if (ceil((double((n + 1) - clock[s[2]]) / 4) + 1) ==
      floor((double((n + 1) - clock[s[2]]) / 4) + 1)) {
    cout << "cw";
    return 0;
  }
  if (ceil((double((n + 1) - anti[s[2]]) / 4) + 1) ==
      floor((double((n + 1) - anti[s[2]]) / 4) + 1)) {
    cout << "ccw";
    return 0;
  }
  cout << "undefined";
}
