#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1073741824")
#pragma GCC optimize("Ofast")
using namespace std;
using namespace placeholders;
const int inf = (int)1e9 + 9;
const long long linf = (long long)1e18 + 1;
const long double eps = 1e-9;
const int mod = (int)1e9 + 7;
const int smod = 16769023;
const long long lmod = 27644437;
const long double pi = acos(-1);
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  char a, b;
  cin >> a >> b;
  int t;
  cin >> t;
  map<char, int> kek = {{'^', 0}, {'>', 1}, {'v', 2}, {'<', 3}};
  a = kek[a];
  b = kek[b];
  if ((a + t) % 4 == b) {
    if ((a - (t % 4) + 4) % 4 == b) {
      cout << "undefined";
      return 0;
    }
    cout << "cw";
    return 0;
  }
  cout << "ccw";
}
