#include <bits/stdc++.h>
using namespace std;
int p[5];
int q[5];
char ch1, ch2;
int n;
int main() {
  p[1] = 118;
  p[2] = 60;
  p[3] = 94;
  p[0] = 62;
  q[1] = 118;
  q[2] = 62;
  q[3] = 94;
  q[0] = 60;
  scanf("%c %c", &ch1, &ch2);
  scanf("%d", &n);
  int m = n % 4;
  int a = int(ch1);
  int b = int(ch2);
  int c1;
  int c2;
  for (int i = 0; i <= 3; i++) {
    if (p[i] == a) c1 = i;
    if (q[i] == a) c2 = i;
  }
  c1 += m;
  c2 += m;
  c1 %= 4;
  c2 %= 4;
  if (p[c1] == b && q[c2] == b)
    cout << "undefined" << endl;
  else if (p[c1] == b)
    cout << "cw" << endl;
  else if (q[c2] == b)
    cout << "ccw" << endl;
  else
    cout << "undefined" << endl;
  return 0;
}
