#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  int a[150];
  a[118] = 1;
  a[60] = 2;
  a[94] = 3;
  a[62] = 4;
  char s, e;
  cin >> s >> e;
  cin >> n;
  int b = (a[s] + n - 1) % 4 + 1;
  int c = (a[s] - n + 1000000000 - 1) % 4 + 1;
  if (b == a[e] && c != a[e]) {
    cout << "cw" << endl;
    return 0;
  }
  if (c == a[e] && b != a[e]) {
    cout << "ccw" << endl;
    return 0;
  }
  cout << "undefined" << endl;
  return 0;
}
