E. Unusual Fractions
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Martians write fractions as follows: the notation $$$\{a\}/\{b\}$$$ denotes the fraction with numerator "$$$a$$$" and denominator "$$$b$$$". Martians do not allow spaces in fraction notation, and curly braces are used only to write fractions.

The following rules are used to convert the Martian notation into the ordinary one:

  • the fraction bar is made of "minus" signs and is placed so that the numerator is entirely above it and the denominator is entirely below it;
  • the numerator and the denominator are placed so that the width of the fraction is the minimum possible;
  • then the fraction bar is extended by two more characters: one "minus" on the left and one on the right;
  • the fraction bars of adjacent fractions are at the same height; two fractions are called adjacent if there are no other fractions between them (in the Martian notation);
  • the characters written between adjacent fractions are placed at the same height as their fraction bars.

For example, the notation

{m}/{{n}/{q}}+{{x}/{y}}/{z}

is converted into the ordinary one as follows:

x
---
m y
-----+-----
n z
---
q

Its width is $$$11$$$ characters, and its height is $$$7$$$ lines.

Given a Martian notation, determine the width and the height of its ordinary notation. You do not need to build the ordinary notation itself.

Input

The only line contains a Martian notation $$$S$$$ ($$$7 \le |S| \le 250$$$). The string consists of printable ASCII characters except space.

It is guaranteed that $$$S$$$ is a correct Martian notation (the definition is given in the notes).

Output

Print two positive integers separated by a space — the width of the ordinary notation in characters and its height in lines.

Examples
Input
{m}/{{n}/{q}}+{{x}/{y}}/{z}
Output
11 7
Input
{2m}/{{n}/{q}}+{{x}/{y}}/{z+1}
Output
11 7
Input
{a-+-b/cc}/{3}
Output
10 3
Note

Let a character be any printable character except space and curly braces (including "/"). A correct Martian notation is defined as follows:

  • a fraction is a notation $$$\{A\}/\{B\}$$$, where the numerator $$$A$$$ and the denominator $$$B$$$ are expressions;
  • an expression is a non-empty sequence of characters and fractions in which there is at least one character between any two adjacent fractions;
  • the whole string $$$S$$$ is an expression that begins and ends with a fraction;
  • the sequence of characters between adjacent fractions cannot consist of a single character "/": notations like $$$\{a\}/\{b\}/\{c\}$$$ or $$$\{a\}/\{b\}/\{c\}/\{d\}$$$ never occur.
The character "/" outside the construction $$$\}/\{$$$ is an ordinary character.

The first example is explained in the statement. In the second example, the ordinary notation is:

x
---
2m y
-----+-----
n z+1
---
q
The fraction $$$\{n\}/\{q\}$$$ has width $$$1 + 2 = 3$$$, so the left fraction has width $$$\max(2, 3) + 2 = 5$$$; the right one also has width $$$\max(3, 3) + 2 = 5$$$; together with the "+" sign, the width is $$$5 + 1 + 5 = 11$$$. There are $$$3$$$ lines above the fraction bars (because of $$$\{x\}/\{y\}$$$) and also $$$3$$$ below them (because of $$$\{n\}/\{q\}$$$), so the height is $$$3 + 1 + 3 = 7$$$.

In the third example, "/" inside the numerator is an ordinary character: the numerator "a-+-b/cc" has width $$$8$$$, so the width of the fraction is $$$8 + 2 = 10$$$, and the height is $$$3$$$.