#include <bits/stdc++.h>
using namespace std;
char next_clock(char current) {
  if (current == 'v') return '<';
  if (current == '<') return '^';
  if (current == '^') return '>';
  if (current == '>') return 'v';
}
char prev_clock(char current) {
  if (current == 'v') return '>';
  if (current == '>') return '^';
  if (current == '^') return '<';
  if (current == '<') return 'v';
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  char start, end;
  scanf("%c %c\n", &start, &end);
  scanf("%d", &n);
  n = n % 4;
  char clock = start;
  char counter = start;
  for (int i = 0; i < n; ++i) {
    clock = next_clock(clock);
    counter = prev_clock(counter);
  }
  if (clock == end && counter != end) {
    printf("cw\n");
  } else if (counter == end && clock != end) {
    printf("ccw\n");
  } else {
    printf("undefined\n");
  }
  return 0;
}
