#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  char c, d;
  cin >> c >> d;
  int n;
  cin >> n;
  if (c + d == '<' + '>' || c + d == '^' + 'v' || c == d)
    cout << "undefined";
  else if (c == '<' && d == '^' || c == '^' && d == '>' ||
           c == '>' && d == 'v' || c == 'v' && d == '<')
    if (n % 4 == 1)
      cout << "cw";
    else
      cout << "ccw";
  else if (n % 4 == 1)
    cout << "ccw";
  else
    cout << "cw";
}
