#include <bits/stdc++.h>
using namespace std;
map<char, int> mp;
int n;
int main() {
  mp['v'] = 0;
  mp['<'] = 1;
  mp['^'] = 2;
  mp['>'] = 3;
  char a, b;
  scanf("%c%*c%c", &a, &b);
  scanf("%d", &n);
  n %= 4;
  int tt = (mp[a] + n) % 4;
  int qq = (mp[a] + 4 - n) % 4;
  if (qq == mp[b] && tt == mp[b])
    printf("undefined");
  else if (tt == mp[b])
    printf("cw");
  else
    printf("ccw");
  return 0;
}
