Balance of parentheses#2331

Balance of parentheses

1 secondo
64 megabyte
Molto facile

Given a sequence consisting of opening and closing round, square, and curly brackets.

You must write a program that determines whether it is possible to insert digits and arithmetic operation symbols into this sequence to create a valid bracket expression.

Input

The input file contains at least and at most lines. Each line contains a sequence of brackets. The length of a sequence does not exceed .

Output

In a single line of the output file, output the characters 0 or 1. The total number of characters must equal the number of input lines. For each input line, output 0 if it is possible to obtain a valid bracket expression, and 1 otherwise.

Esempi

Esempio 1

Loading
Loading