Problems
Queen, rook and bishop
Queen, rook and bishop
\includegraphics{https://static.e-olymp.com/content/9c/9c1532a0ef9fd87557a890db4b397aee8f0f915e.jpg}
On the chessboard, the queen, rook and bishop of the same color. How many fields are under the board fight?
Rook (\textbf{R}) runs only on the horizontals and verticals, the Bishop (\textbf{B}) - only on the diagonals, Queen (\textbf{Q}) - goes on horizontals, verticals and diagonals.
The figure with red dots show the field that are under the gun (in chess terms - under the battle), only the queen, blue - just a rook, green - just an bishop. Yellow dots denote the field under battle queen and rook at the same time, brown - the queen and bishop at the same time, the blue dot denotes the field to the fight while under the bishop and the rook.
\InputFile
In a single line in the international chess notation (see the example input data) are defined by a space position queen, rook and bishop (in no particular order). All input data is valid.
\OutputFile
Derive a single number - the number of checkerboard fields under their "target".
Input example #1
Qe5 Rg7 Bg4
Output example #1
36