#include <bits/stdc++.h>
using namespace std;
int n, a[4] = {118, 60, 94, 62}, ac1, ac2;
int main() {
  char c1, c2;
  cin >> c1 >> c2;
  cin >> n;
  for (int i = 0; i < 4; i++) {
    if ((int)c1 == a[i]) ac1 = i;
    if ((int)c2 == a[i]) ac2 = i;
  }
  if ((ac1 + n) % 4 == ac2 && (((ac1 - n) % 4) + 4) % 4 == ac2)
    cout << "undefined" << endl;
  else if ((ac1 + n) % 4 == ac2)
    cout << "cw" << endl;
  else
    cout << "ccw" << endl;
  return 0;
}
