#include <bits/stdc++.h>
using namespace std;
int get(char x) {
  if (x == 118) return 0;
  if (x == 60) return 1;
  if (x == 94) return 2;
  return 3;
}
int main() {
  char s, e;
  int n, si, ei;
  cin >> s >> e;
  cin >> n;
  si = get(s);
  ei = get(e);
  n = n % 4;
  bool a = false, b = false;
  int sii = si, eii = si;
  for (int i = 0; i < n; i++) {
    sii++;
  }
  sii = sii % 4;
  a = sii == ei;
  for (int i = 0; i < n; i++) {
    eii--;
  }
  while (eii < 0) eii += 4;
  eii = eii % 4;
  b = eii == ei;
  if (a && !b) {
    cout << "cw" << endl;
  } else if (b && !a) {
    cout << "ccw" << endl;
  } else {
    cout << "undefined" << endl;
  }
}
