#include <bits/stdc++.h>
using namespace std;
int main() {
  char s1, s2;
  cin >> s1 >> s2;
  int n, k, ch = -1;
  cin >> n;
  k = n % 4;
  if (k == 0 || k == 2)
    ch = -1;
  else {
    if (s1 == '<') {
      if (k == 1) {
        if (s2 == '^')
          ch = 1;
        else if (s2 == 'v')
          ch = 2;
      } else if (k == 3) {
        if (s2 == '^')
          ch = 2;
        else if (s2 == 'v')
          ch = 1;
      }
    } else if (s1 == '^') {
      if (k == 1) {
        if (s2 == '>')
          ch = 1;
        else if (s2 == '<')
          ch = 2;
      } else if (k == 3) {
        if (s2 == '<')
          ch = 1;
        else if (s2 == '>')
          ch = 2;
      }
    } else if (s1 == '>') {
      if (k == 1) {
        if (s2 == '^')
          ch = 2;
        else if (s2 == 'v')
          ch = 1;
      } else if (k == 3) {
        if (s2 == '^')
          ch = 1;
        else if (s2 == 'v')
          ch = 2;
      }
    } else if (s1 == 'v') {
      if (k == 1) {
        if (s2 == '<')
          ch = 1;
        else if (s2 == '>')
          ch = 2;
      } else if (k == 3) {
        if (s2 == '>')
          ch = 1;
        else if (s2 == '<')
          ch = 2;
      }
    }
  }
  if (ch == -1)
    cout << "undefined" << endl;
  else if (ch == 1)
    cout << "cw" << endl;
  else
    cout << "ccw" << endl;
}
