#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, long long> mp1, mp2;
  mp1['v'] = 1;
  mp1['<'] = 2;
  mp1['^'] = 3;
  mp1['>'] = 4;
  mp2['v'] = 1;
  mp2['>'] = 2;
  mp2['^'] = 3;
  mp2['<'] = 4;
  char a, b;
  long long n;
  cin >> a >> b;
  cin >> n;
  n = n % 4;
  long long one, two;
  one = (mp1[a] + n) % 4;
  if (one == 0) one = 4;
  two = (mp2[a] + n) % 4;
  if (two == 0) two = 4;
  long long f1 = 0, f2 = 0;
  if (one == mp1[b]) f1 = 1;
  if (two == mp2[b]) f2 = 1;
  if (f1 == 1 && f2 == 0) {
    cout << "cw" << endl;
    return 0;
  } else if (f1 == 0 && f2 == 1) {
    cout << "ccw" << endl;
    return 0;
  }
  cout << "undefined" << endl;
}
