#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, -1, 0};
int dy[] = {1, 0, 0, -1};
long long pw(long long b, long long p) {
  if (!p) return 1;
  long long sq = pw(b, p / 2) % 1000000007;
  sq = (sq * sq) % 1000000007;
  if (p % 2) sq = (sq * b) % 1000000007;
  return sq;
}
const int N = 1e5 + 5, LG = 18;
char f[] = {'v', '<', '^', '>'};
char ba[] = {'v', '>', '^', '<'};
map<char, int> mp, mpp;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  mp['v'] = 0;
  mp['<'] = 1;
  mp['^'] = 2;
  mp['>'] = 3;
  mpp['v'] = 0;
  mpp['<'] = 3;
  mpp['^'] = 2;
  mpp['>'] = 1;
  char a, b, tb;
  cin >> a >> b;
  tb = b;
  int n;
  cin >> n;
  n %= 4;
  int i = mp[a];
  int j = mpp[a];
  b = a;
  for (int k = 0; k < n; k++) {
    a = f[(++i) % 4];
    b = ba[(++j) % 4];
  }
  if ((tb == a && tb == b) || (tb != a && tb != b))
    cout << "undefined";
  else if (tb == a)
    cout << "cw";
  else
    cout << "ccw";
  return 0;
}
