#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 0x7ffffff;
const int magic = 348;
string s1, s2;
string s;
int n;
int nxt1[200], nxt2[200];
int main() {
  cin >> s1 >> s2;
  cin >> n;
  n %= 4;
  nxt1[94] = 62;
  nxt1[62] = 118;
  nxt1[118] = 60;
  nxt1[60] = 94;
  nxt2[94] = 60;
  nxt2[60] = 118;
  nxt2[118] = 62;
  nxt2[62] = 94;
  bool f1 = false, f2 = false;
  s = s1;
  for (int i = 1; i <= n; i++) s[0] = nxt1[s[0]];
  if (s == s2) f1 = true;
  s = s1;
  for (int i = 1; i <= n; i++) s[0] = nxt2[s[0]];
  if (s == s2) f2 = true;
  if (f1 && f2) {
    cout << "undefined" << endl;
  } else {
    if (f1)
      cout << "cw" << endl;
    else
      cout << "ccw" << endl;
  }
  return 0;
}
