#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(0);
  char a, b;
  cin >> a >> b;
  long long n;
  cin >> n;
  int i, f;
  n = n % 4;
  if (a == '^')
    i = 0;
  else if (a == '>')
    i = 1;
  else if (a == 'v')
    i = 2;
  else if (a == '<')
    i = 3;
  if (b == '^')
    f = 0;
  else if (b == '>')
    f = 1;
  else if (b == 'v')
    f = 2;
  else if (b == '<')
    f = 3;
  if (n == 0 || n == 2)
    cout << "undefined";
  else if ((i + n) % 4 == f)
    cout << "cw";
  else
    cout << "ccw";
  return (0);
}
