#include <bits/stdc++.h>
using namespace std;
int main() {
  char cc[300], x[300];
  cc['<'] = 0;
  cc['^'] = 1;
  cc['>'] = 2;
  cc['v'] = 3;
  x[0] = '<';
  x[1] = '^';
  x[2] = '>';
  x[3] = 'v';
  char c1, c2;
  int n;
  cin >> c1 >> c2 >> n;
  int start = cc[c1];
  int finish = x[(start + n) % 4];
  int finish2 = x[(1500000000 + start - n) % 4];
  if (finish == finish2)
    cout << "undefined" << endl;
  else
    cout << (c2 == finish ? "cw" : "ccw") << endl;
  return 0;
}
