The official statement of a problem is always the one
in the PDF document. The HTML version of the statement
is also given to help you, but may contain some content
that is not well displayed. In case of doubt, always use the PDF.
Public test cases
Input
10
L 360 1500 2000
L 480 1200 1800
L 720 900 1400
S black 4.2 2000 1500
S red 5.2 2000 1200
S blue 14.3 2000 900
S green 11.2 2000 1400
S red 4.7 1400 900
S black 7.7 1800 900
S green 6.1 1800 900
Output
1502.40
Input
10
L 360 1500 2000
L 480 1200 1800
L 720 900 1400
S black 4.2 2000 1500
S red 5.2 2000 1200
S blue 14.3 2000 900
S green 11.2 2000 1400
S red 4.7 1400 900
S black 7.7 1800 900
S green 6.1 1800 900