#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  ios::sync_with_stdio(0);
  char c1, c2, t1, t2;
  long long n;
  cin >> c1 >> c2;
  cin >> n;
  n %= 4;
  t1 = c1;
  for (int i = 0; i < n; i++) {
    if (t1 == '^')
      t1 = '>';
    else if (t1 == '>')
      t1 = 'v';
    else if (t1 == 'v')
      t1 = '<';
    else if (t1 == '<')
      t1 = '^';
  }
  t2 = c1;
  for (int i = 0; i < n; i++) {
    if (t2 == '^')
      t2 = '<';
    else if (t2 == '<')
      t2 = 'v';
    else if (t2 == 'v')
      t2 = '>';
    else if (t2 == '>')
      t2 = '^';
  }
  if (t1 == c2 && t2 == c2) return cout << "undefined", 0;
  if (t1 == c2) return cout << "cw", 0;
  if (t2 == c2) cout << "ccw";
  return 0;
}
