#include <bits/stdc++.h>
using namespace std;
int main(void) {
  char start, end;
  int n;
  int spinner[300];
  spinner['<'] = 0;
  spinner['^'] = 1;
  spinner['>'] = 2;
  spinner['v'] = 3;
  scanf(" %c %c", &start, &end);
  scanf(" %d", &n);
  n %= 4;
  if (n == 1 || n == 3) {
    if ((spinner[start] + n) % 4 == spinner[end])
      cout << "cw" << endl;
    else
      cout << "ccw" << endl;
  } else
    cout << "undefined" << endl;
  return 0;
}
