#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, dist1, dist2;
  char ch[3], a;
  ch[0] = getchar();
  a = getchar();
  ch[2] = getchar();
  cin >> n;
  n = n % 4;
  if (n == 1 &&
      ((ch[0] == '^' && ch[2] == '>') || (ch[0] == '>' && ch[2] == 'v') ||
       (ch[0] == 'v' && ch[2] == '<') || (ch[0] == '<' && ch[2] == '^')))
    cout << "cw";
  else if (n == 1 &&
           ((ch[0] == '^' && ch[2] == '<') || (ch[0] == '<' && ch[2] == 'v') ||
            (ch[0] == 'v' && ch[2] == '>') || (ch[0] == '>' && ch[2] == '^')))
    cout << "ccw";
  else if (n == 3 &&
           ((ch[0] == '^' && ch[2] == '<') || (ch[0] == '>' && ch[2] == '^') ||
            (ch[0] == 'v' && ch[2] == '>') || (ch[0] == '<' && ch[2] == 'v')))
    cout << "cw";
  else if (n == 3 &&
           ((ch[0] == '^' && ch[2] == '>') || (ch[0] == '<' && ch[2] == '^') ||
            (ch[0] == 'v' && ch[2] == '<') || (ch[0] == '>' && ch[2] == 'v')))
    cout << "ccw";
  else
    cout << "undefined";
}
