Under construction

Still being built. Things may change

Train Seat

Time limit2sMemory limit1024 MB

Summary
Given a car type (R or C) and a seat number, print the compartment, whether the seat is a side seat, and whether it is upper or lower, or -1 if the seat does not exist.
Level

Easy2 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Vasya decided to visit Novorossiysk for the weekend by train and bought an electronic ticket to save money. After he filled out the order form and paid, he received the trip details, including the car type and seat number. He wondered whether the seat was upper or lower, side or compartment. He wanted to check the car diagram on the website where he bought the ticket, but the power went out. With nothing else to do, he tried to recall what he knew about railway cars.

He remembered the following. His car has exactly 99 compartments, numbered from 1 to 99 starting from the front of the car. If the car is platzkart, each compartment has 4 compartment seats and 2 side seats, so the car has 5454 seats. If the car is coupe, it has no side seats, so it has 3636 seats. Compartment seats are numbered from the front of the car, with seat 11 at the very front and seat 3636 at the very back. Side seats are numbered from the back of the car, with seat 5454 at the front and seat 3737 at the back. Odd-numbered seats are lower berths, and even-numbered seats are upper berths.

Input

The input begins with R if the car is platzkart, or C if the car is coupe. Right after the first character comes the seat number, a positive integer from 11 to 5454.

Output

Print -1 if the seat does not exist in that car type. Otherwise print three integers a, b, c separated by spaces. a is the compartment number of Vasya's seat. b is 0 if the seat is a side seat and 1 if it is a compartment seat. c is 1 if the seat is upper and -1 if it is lower.

Examples3

  1. Example 1

    Input
    R53
    
    Expected output
    1 0 -1
    
  2. Example 2

    Input
    C2
    
    Expected output
    1 1 1
    
  3. Example 3

    Input
    C37
    
    Expected output
    -1