#include <bits/stdc++.h>
using namespace std;
map<string, int> cmp, ccmp;
int main() {
  ios::sync_with_stdio(false);
  cmp["^ >"] = 1;
  cmp["^ v"] = 2;
  cmp["^ <"] = 3;
  cmp["> v"] = 1;
  cmp["> <"] = 2;
  cmp["> ^"] = 3;
  cmp["v <"] = 1;
  cmp["v ^"] = 2;
  cmp["v >"] = 3;
  cmp["< ^"] = 1;
  cmp["< >"] = 2;
  cmp["< v"] = 3;
  ccmp["^ >"] = 3;
  ccmp["^ v"] = 2;
  ccmp["^ <"] = 1;
  ccmp["> v"] = 3;
  ccmp["> <"] = 2;
  ccmp["> ^"] = 1;
  ccmp["v <"] = 3;
  ccmp["v ^"] = 2;
  ccmp["v >"] = 1;
  ccmp["< ^"] = 3;
  ccmp["< >"] = 2;
  ccmp["< v"] = 1;
  string str;
  int num;
  getline(cin, str);
  cin >> num;
  num %= 4;
  if (num == cmp[str] && num == ccmp[str])
    cout << "undefined" << endl;
  else if (num == cmp[str])
    cout << "cw" << endl;
  else if (num == ccmp[str])
    cout << "ccw" << endl;
  else
    cout << "undefined" << endl;
  return 0;
}
