Problem: Golorps are mysterious creatures who feed on variables. Golorp's name is a program in some programming language. Some scientists believe that this language is Befunge; golorps are tantalizingly silent.

Variables consumed by golorps can take values from 0 to 9, inclusive. For each golorp its daily diet is defined by its name. Some golorps are so picky that they can't be fed at all. Besides, all golorps are very health-conscious and try to eat as little as possible. Given a choice of several valid sequences of variable values, each golorp will choose lexicographically smallest one.

For the purposes of this problem you can assume that a golorp consists of jaws and a stomach. The number of variables necessary to feed a golorp is defined by the shape of its jaws. Variables can get to the stomach only via the jaws.

A hungry golorp is visiting you. You know its name; feed it or figure out that it's impossible.

Input

The input is a single string (between 13 and 1024 characters long) — the name of the visiting golorp. All names are similar and will resemble the ones given in the samples. The name is guaranteed to be valid.

Output

Output lexicographically smallest sequence of variable values fit for feeding this golorp. Values should be listed in the order in which they get into the jaws. If the golorp is impossible to feed, output "false".

Examples

Input

?(_-_/___*__):-___&gt;__.


Output

0010


Input

?(__-_+_/_____):-__&gt;__,_____&lt;__.


Output

false


Input

?(______________________/____+_______*__-_____*______-___):-__&lt;___,___&lt;____,____&lt;_____,_____&lt;______,______&lt;_______.


Output

0250341


Input

?(__+___+__-___):-___&gt;__.


Output

0101

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O2")
#pragma GCC optimization("unroll-loops")
const long double ERR = 1e-5;
const int MOD = 1e9 + 7;
bool areEqual(long double _n1, long double _n2) {
  return fabs(_n1 - _n2) < ERR;
}
struct condition {
  int L, R;
  condition() {}
  condition(int _L, int _R) : L(_L), R(_R) {}
  condition(string jaw) {
    L = R = 0;
    char op = '~';
    for (char c : jaw) {
      if (c == '>' || c == '<') {
        op = c;
        continue;
      } else if (op == '~')
        L++;
      else
        R++;
    }
    if (op == '<') swap(L, R);
  }
  friend ostream &operator<<(ostream &o, condition c) {
    return o << c.L << " > " << c.R;
  }
};
const int maxN = 1025;
int N;
string GOLORP, BELLY, JAW;
vector<vector<int> > adj(maxN);
vector<condition> conditionList;
int exists[maxN] = {}, inDegree[maxN] = {}, inOrder[maxN] = {}, VAL[maxN] = {};
vector<int> bellyNumbers;
unordered_set<int> inputValues;
void formatInput();
void processCondition(string);
void processBelly(string);
bool topoSort();
bool conditionComp(condition, condition);
bool findValues();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  getline(cin, GOLORP);
  formatInput();
  if (!topoSort()) {
    cout << "false" << '\n';
    return 0;
  }
  sort(conditionList.begin(), conditionList.end(), conditionComp);
  if (!findValues()) {
    cout << "false" << '\n';
    return 0;
  }
  for (int b : bellyNumbers) {
    cout << VAL[b];
  }
  cout << '\n';
  return 0;
  for (int i = 0; i < maxN; i++) {
    if (!exists[i]) continue;
    cout << "[ "
         << "i"
         << ": " << i << " ]" << flush << "[ "
         << "inOrder[i]"
         << ": " << inOrder[i] << " ]" << flush << '\n';
  }
  for (condition c : conditionList) {
    cout << "[ "
         << "c"
         << ": " << c << " ]" << flush << '\n';
  }
  cout << "[ "
       << "bellyNumbers"
       << ": ";
  for (auto _i : bellyNumbers) cout << _i << ' ';
  cout << "]" << flush << '\n';
}
bool findValues() {
  bool madeChange = true;
  while (madeChange) {
    madeChange = false;
    for (condition C : conditionList) {
      if (VAL[C.L] > VAL[C.R]) continue;
      madeChange = true;
      VAL[C.L]++;
      if (VAL[C.L] == 10) return false;
    }
  }
  return true;
}
bool conditionComp(condition p, condition q) {
  if (inOrder[p.L] != inOrder[q.L]) return inOrder[p.L] < inOrder[q.L];
  if (inOrder[p.R] != inOrder[q.R]) return inOrder[p.R] < inOrder[q.R];
  if (p.L != q.L) return p.L < q.L;
  return p.R < q.R;
}
bool topoSort() {
  int nextOrder = 1;
  queue<int> q;
  for (int i = 0; i < maxN; i++) {
    if (exists[i] && !inDegree[i]) q.push(i);
  }
  while (!q.empty()) {
    int V = q.front();
    q.pop();
    inOrder[V] = nextOrder++;
    for (int _V : adj[V]) {
      inDegree[_V]--;
      if (!inDegree[_V]) q.push(_V);
    }
  }
  return nextOrder == N + 1;
}
void processBelly(string belly) {
  for (char &c : belly)
    if (c != '_') c = ' ';
  stringstream SS(belly);
  string seg;
  int V;
  while (SS >> seg) {
    V = seg.length();
    exists[V] = true;
    inputValues.insert(V);
    bellyNumbers.push_back(V);
  }
}
void processCondition(string jaw) {
  condition C(jaw);
  inDegree[C.R]++;
  adj[C.L].push_back(C.R);
  conditionList.push_back(C);
  exists[C.L] = exists[C.R] = true;
  inputValues.insert(C.L);
  inputValues.insert(C.R);
}
void formatInput() {
  for (int i = 0; i < GOLORP.size(); i++) {
    if (GOLORP[i] == ':')
      GOLORP[i] = GOLORP[i + 1] = ' ';
    else if (GOLORP[i] == '?' || GOLORP[i] == '(' || GOLORP[i] == ')' ||
             GOLORP[i] == ',' || GOLORP[i] == '.')
      GOLORP[i] = ' ';
  }
  stringstream SS(GOLORP);
  SS >> BELLY;
  processBelly(BELLY);
  while (SS >> JAW) {
    processCondition(JAW);
  }
  N = inputValues.size();
}