#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
signed main(void) {
  char s, f;
  cin >> s >> f;
  int n;
  cin >> n;
  n %= 4;
  int ss, ff;
  if (s == '^')
    ss = 0;
  else if (s == '>')
    ss = 1;
  else if (s == 'v')
    ss = 2;
  else if (s == '<')
    ss = 3;
  if (f == '^')
    ff = 0;
  else if (f == '>')
    ff = 1;
  else if (f == 'v')
    ff = 2;
  else if (f == '<')
    ff = 3;
  if ((ss + n) % 4 == ff && (ss - n + 4) % 4 == ff)
    cout << "undefined" << endl;
  else if ((ss + n) % 4 == ff)
    cout << "cw" << endl;
  else if ((ss - n + 4) % 4 == ff)
    cout << "ccw" << endl;
  else
    cout << "undefined" << endl;
  return 0;
}
