#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, x, y, spos, epos;
  string s;
  getline(cin, s);
  cin >> t;
  x = t % 4;
  if (x == 2 || x == 0) {
    cout << "undefined";
  } else if (x == 1) {
    if ((s[0] == '^' && s[2] == '>') || (s[0] == '>' && s[2] == 'v') ||
        (s[0] == 'v' && s[2] == '<') || (s[0] == '<' && s[2] == '^')) {
      cout << "cw";
    } else if ((s[0] == '^' && s[2] == '<') || (s[0] == '>' && s[2] == '^') ||
               (s[0] == 'v' && s[2] == '>') || (s[0] == '<' && s[2] == 'v')) {
      cout << "ccw";
    }
  } else if (x == 3) {
    if ((s[0] == '^' && s[2] == '<') || (s[0] == '>' && s[2] == '^') ||
        (s[0] == 'v' && s[2] == '>') || (s[0] == '<' && s[2] == 'v')) {
      cout << "cw";
    } else if ((s[0] == '^' && s[2] == '>') || (s[0] == '>' && s[2] == 'v') ||
               (s[0] == 'v' && s[2] == '<') || (s[0] == '<' && s[2] == '^')) {
      cout << "ccw";
    }
  }
  return 0;
}
