#include <bits/stdc++.h>
using namespace std;
int main() {
  char x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  n = n % 4;
  if (n == 0 || n == 2)
    cout << "undefined\n";
  else {
    if (n == 1) {
      if (x == '^' && y == '>')
        cout << "cw\n";
      else if (x == '^' && y == '<')
        cout << "ccw\n";
      else if (x == '>' && y == 'v')
        cout << "cw\n";
      else if (x == '>' && y == '^')
        cout << "ccw\n";
      else if (x == 'v' && y == '<')
        cout << "cw\n";
      else if (x == 'v' && y == '>')
        cout << "ccw\n";
      else if (x == '<' && y == '^')
        cout << "cw\n";
      else if (x == '<' && y == 'v')
        cout << "ccw\n";
    } else if (n == 3) {
      if (x == '^' && y == '<')
        cout << "cw\n";
      else if (x == '^' && y == '>')
        cout << "ccw\n";
      else if (x == '>' && y == '^')
        cout << "cw\n";
      else if (x == '>' && y == 'v')
        cout << "ccw\n";
      else if (x == 'v' && y == '>')
        cout << "cw\n";
      else if (x == 'v' && y == '<')
        cout << "ccw\n";
      else if (x == '<' && y == 'v')
        cout << "cw\n";
      else if (x == '<' && y == '^')
        cout << "ccw\n";
    }
  }
  return 0;
}
