#include <bits/stdc++.h>
using namespace std;
long long const delta = 1000000007;
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  char a, b;
  cin >> a >> b;
  long long t;
  cin >> t;
  long long a1, b1;
  if (a == '^') a1 = 0;
  if (a == '>') a1 = 1;
  if (a == 'v') a1 = 2;
  if (a == '<') a1 = 3;
  if (b == '^') b1 = 0;
  if (b == '>') b1 = 1;
  if (b == 'v') b1 = 2;
  if (b == '<') b1 = 3;
  if (((a1 + t) % 4 == b1) && ((a1 - t + (4 * (long long)1e12 + 8)) % 4 == b1))
    return cout << "undefined", 0;
  if ((a1 + t) % 4 == b1) return cout << "cw", 0;
  if ((a1 - t + (4 * (long long)1e12 + 8)) % 4 == b1) return cout << "ccw", 0;
  cout << "undefined ";
  return 0;
}
