#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  ;
  char a, b;
  cin >> a >> b;
  long long n;
  cin >> n;
  n = n % 4;
  long long p, q;
  if (a == '^') {
    p = 0;
  } else if (a == '>') {
    p = 1;
  } else if (a == 'v') {
    p = 2;
  } else if (a == '<') {
    p = 3;
  }
  if (b == '^') {
    q = 0;
  } else if (b == '>') {
    q = 1;
  } else if (b == 'v') {
    q = 2;
  } else if (b == '<') {
    q = 3;
  }
  int k = (q - p) % 4;
  if (k < 0) {
    k += 4;
  }
  if (n == 2 || n == 0) {
    cout << "undefined";
  } else if (n == k) {
    cout << "cw";
  } else if (n == 4 - k) {
    cout << "ccw";
  }
  return 0;
}
