#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
long long n, l, k;
long long array[1 << 18];
int main() {
  map<char, int> ref = {{'^', 0}, {'>', 1}, {'v', 2}, {'<', 3}};
  char s, e;
  cin >> s >> e;
  int n;
  cin >> n;
  int tot = (n / 4 + 1) * 4;
  bool a = (tot + (ref[s] - n)) % 4 == ref[e];
  bool b = (ref[s] + n) % 4 == ref[e];
  if (a && b) {
    cout << "undefined" << '\n';
    return 0;
  }
  if (a)
    cout << "ccw" << '\n';
  else if (b)
    cout << "cw" << '\n';
}
