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