#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int a[10], n;
char s1, s2;
int main() {
  a[0] = 118, a[1] = 60, a[2] = 94, a[3] = 62;
  while (cin >> s1 >> s2) {
    scanf("%d", &n);
    n %= 4;
    int k;
    for (int i = 0; i < 4; i++)
      if ((int)s1 == a[i]) {
        k = i;
        break;
      }
    int kk = (k + n) % 4, kkk = ((k - n) % 4 + 4) % 4;
    if (a[kk] == (int)s2 && kkk == kk)
      printf("undefined\n");
    else if (a[kk] == (int)s2)
      printf("cw\n");
    else
      printf("ccw\n");
  }
  return 0;
}
