#include <bits/stdc++.h>
using namespace std;
int n;
char s1, s2;
map<char, int> m;
void nhap() {
  scanf("%c", &s1);
  scanf("%c", &s2);
  scanf("%c", &s2);
  scanf("%d", &n);
  m['^'] = 1;
  m['>'] = 2;
  m['v'] = 3;
  m['<'] = 4;
}
int main() {
  nhap();
  if (n % 2 == 0) {
    cout << "undefined";
    return 0;
  }
  int so1 = m[s1];
  int so2 = m[s2];
  n %= 4;
  so1 = (so1 + n) % 4;
  if (so1 == 0) so1 = 4;
  if (so1 == so2)
    cout << "cw";
  else
    cout << "ccw";
  return 0;
}
