#include <bits/stdc++.h>
using namespace std;
int main() {
  char a, b;
  cin >> a >> b;
  long long n;
  cin >> n;
  n = n % 4;
  if (n == 0) {
    cout << "undefined";
    return 0;
  }
  if (n == 1) {
    if (a == 'v') {
      if (b == '>') {
        cout << "ccw";
        return 0;
      }
      if (b == '<') {
        cout << "cw";
        return 0;
      }
    }
    if (a == '>') {
      if (b == 'v') {
        cout << "cw";
        return 0;
      }
      if (b == '^') {
        cout << "ccw";
        return 0;
      }
    }
    if (a == '^') {
      if (b == '>') {
        cout << "cw";
        return 0;
      }
      if (b == '<') {
        cout << "ccw";
        return 0;
      }
    }
    if (a == '<') {
      if (b == '^') {
        cout << "cw";
        return 0;
      }
      if (b == 'v') {
        cout << "ccw";
        return 0;
      }
    }
  }
  if (n == 2) {
    cout << "undefined";
    return 0;
  }
  if (n == 3) {
    if (a == 'v') {
      if (b == '>') {
        cout << "cw";
        return 0;
      }
      if (b == '<') {
        cout << "ccw";
        return 0;
      }
    }
    if (a == '>') {
      if (b == 'v') {
        cout << "ccw";
        return 0;
      }
      if (b == '^') {
        cout << "cw";
        return 0;
      }
    }
    if (a == '^') {
      if (b == '>') {
        cout << "ccw";
        return 0;
      }
      if (b == '<') {
        cout << "cw";
        return 0;
      }
    }
    if (a == '<') {
      if (b == '^') {
        cout << "ccw";
        return 0;
      }
      if (b == 'v') {
        cout << "cw";
        return 0;
      }
    }
  }
  cout << "undefined";
}
