#include <bits/stdc++.h>
using namespace std;
int main() {
  char c1, c2;
  int t, n1, n2, ans1, ans2;
  string s = "^>v<";
  cin >> c1 >> c2 >> t;
  n1 = s.find(c1);
  n2 = s.find(c2);
  t = t % 4;
  ans1 = (n1 + t) % 4;
  ans2 = (n1 - t);
  if (ans2 < 0) ans2 += 4;
  if (ans1 == n2 && ans2 == n2)
    puts("undefined");
  else if (ans1 == n2)
    puts("cw");
  else
    puts("ccw");
  return 0;
}
