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 JAVA):

Solution:
import java.util.*;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.RecursiveAction;
import java.util.concurrent.RecursiveTask;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.*;

import javax.swing.plaf.SliderUI;

import static java.lang.Math.*;

public class Solution implements Runnable {
	
	ArrayList<Integer> g [];
	ArrayList<Integer> topoSort = new ArrayList<>();
	
	int vars[];
	int topIndex [];
	int color [];
	int variables[];
	
	boolean used [];
	
	boolean findCycle(int v) {
		if (color[v] == 2)
			return false;
		if (color[v] == 1)
			return true;
		color[v] = 1;
		for (int i = 0; i < g[v].size(); i++)
			if (findCycle(g[v].get(i)))
				return true;
		color[v] = 2;
		return false;
	}
	
	void dfs(int v) {
		if (used[v])
			return;
		used[v] = true;
		variables[v] = 0;
		for (int i = 0; i < g[v].size(); i++) {
			dfs(g[v].get(i));
		}
		topoSort.add(v);
	}
	
	void findDivisonByZeroTypes(Node node) {
		if (node instanceof OperationNode) {
			OperationNode opNode = (OperationNode) node;
			VariableNode right = (VariableNode) opNode.right;
			if (opNode.operation == '/') {
				variables[right.variableType] = 1;
			}
			findDivisonByZeroTypes(opNode.left);
			findDivisonByZeroTypes(opNode.right);
		} else {
			return;
		}
	}
	
	interface Node {
		
		long eval (int[] variables);
		
	}
	
	class VariableNode implements Node {
		
		int variableIndex;
		int variableType;
		
		public VariableNode(int variableIndex, int variableType) {
			this.variableIndex = variableIndex;
			this.variableType = variableType;
		}
		
		@Override
		public long eval(int[] variables) {
			return variables[variableIndex];
		}
		
	}
	
	class OperationNode implements Node {
		
		char operation;
		Node left, right;
		
		public OperationNode(Node left, Node right, char operation) {
			this.left = left;
			this.right = right;
			this.operation = operation;
		}
		
		@Override
		public long eval(int[] variables) {
			long l = left.eval(variables);
			long r = right.eval(variables);
			switch (operation) {
				case '+':
					return l + r;
				case '-':
					return l - r;
				case '*':
					return l * r;
				case '/':
					return l / r;
			}
			return 0;
		}
		
	}
	
	class Parser {
		
		int it;
		String expression;
		
		int operationPriority[] = new int [256];
		
		int variables;
		ArrayList<Integer> variableTypes = new ArrayList<>();
		
		public Parser() {
			operationPriority['-'] = operationPriority['+'] = 0;
			operationPriority['*'] = operationPriority['/'] = 1;
		}
		
		public Parser(String expression) {
			super();
			this.expression = expression;
		}
		
		public Node parse() {
			it = 0;
			return parse(0);
		}
		
		public int[] getVars() {
			int[] vars = new int [variables];
			for (int i = 0; i < variables; i++) {
				vars[i] = variableTypes.get(i);
			}
			return vars;
		}
		
		private Node parseValue() {
			int variableType = 0;
			while (it < expression.length() && expression.charAt(it) == '_') {
				variableType++;
				it++;
			}
			variables++;
			variableTypes.add(variableType);
			return new VariableNode(variables - 1, variableType);
		}
		
		private Node parse(int prior) {
			if (prior == 2)
				return parseValue();
			Node result = parse(prior + 1);
			while (it < expression.length() && operationPriority[expression.charAt(it)] == prior) {
				char operation = expression.charAt(it);
				it++;
				Node right = parse(prior + 1);
				result = new OperationNode(result, right, operation);
			}
			return result;
		}
		
	}
	
	public void solve() throws Exception {
		color = new int [1024];
		g = new ArrayList[1024];
		for (int i = 0; i < 1024; i++)
			g[i] = new ArrayList<>();

		String a = sc.nextToken();
		StringBuilder sb = new StringBuilder();
		
		int lBracket = a.indexOf('(');
		int rBracket = a.indexOf(')');
		
		String expression = a.substring(lBracket + 1, rBracket);
		Parser parser = new Parser(expression); 
		
		Node root = parser.parse();
		
		vars = parser.getVars();
		Integer varIndices[] = new Integer [vars.length];
		for (int i = 0; i < vars.length; i++)
			varIndices[i] = i;
		
		boolean usedTypes [] = new boolean[1024];
		for (int i = 0; i < vars.length; i++) {
			usedTypes[vars[i]] = true;
		}
		
		int colon = a.indexOf(":-");
		String inequalityString = a.substring(colon + 2, a.length() - 1);
		String[] inequalities = inequalityString.split(",");
		for (String inequality : inequalities) {
			char separator;
			int separatorIndex = -1;
			if (inequality.indexOf('>') != -1) {
				separator = '>';
				separatorIndex = inequality.indexOf('>');
			} else {
				separator = '<';
				separatorIndex = inequality.indexOf('<');
			}
			int typeLeft = separatorIndex;
			int typeRight = inequality.length() - separatorIndex - 1;
			if (separator == '>') {
				g[typeLeft].add(typeRight);
			} else {
				g[typeRight].add(typeLeft);
			}
		}
		
		for (int i = 0; i < 1024; i++) {
			if (color[i] == 0) {
				if (findCycle(i)) {
					out.println("false");
					return;
				}
			}
		}

		variables = new int [1024];
		used = new boolean [1024];
		Arrays.fill(variables, -1);
		for (int i = 0; i < 1024; i++) {
			if (usedTypes[i]) {
				dfs(i);
			}
		}
		
		findDivisonByZeroTypes(root);
		
		for (int type : topoSort) {
			int maxValue = 0;
			for (int to : g[type]) {
				maxValue = max (maxValue, variables[to] + 1);
			}
			variables[type] = maxValue;
			if (variables[type] > 9) {
				out.println("false");
				return;
			}
		}
		
		for (int i = 0; i < vars.length; i++) {
			out.print(variables[vars[i]]);
		}
		
	}


	static Throwable t;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Solution.t = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", 1 << 26);
		thread.start();
		thread.join();
		if (Solution.t != null)
			throw t;
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

	public String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

}