#include <bits/stdc++.h>
using namespace std;
int main() {
  char c1, c2;
  cin >> c1 >> c2;
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << "undefined" << endl;
  } else {
    int n1, n2;
    switch (c1) {
      case '^':
        n1 = 1;
        break;
      case '>':
        n1 = 2;
        break;
      case 'v':
        n1 = 3;
        break;
      case '<':
        n1 = 4;
        break;
    }
    switch (c2) {
      case '^':
        n2 = 1;
        break;
      case '>':
        n2 = 2;
        break;
      case 'v':
        n2 = 3;
        break;
      case '<':
        n2 = 4;
        break;
    }
    n %= 4;
    if (n1 != 4) {
      if (n2 - n1 == 1) {
        if (n == 1)
          cout << "cw" << endl;
        else
          cout << "ccw" << endl;
      } else {
        if (n == 1)
          cout << "ccw" << endl;
        else
          cout << "cw" << endl;
      }
    } else {
      if (n1 - n2 == 3) {
        if (n == 1)
          cout << "cw" << endl;
        else
          cout << "ccw" << endl;
      } else {
        if (n == 1)
          cout << "ccw" << endl;
        else
          cout << "cw" << endl;
      }
    }
  }
  return 0;
}
