Completing a Chess Set

Interview

Time limit1sMemory limit128 MB

Summary
Given counts of six white chess piece types, output how many of each must be added or removed to reach a complete 16-piece set.
Level

Easy1 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

Donghyuk found an old chessboard and some chess pieces while looking through a storage room.

After cleaning the board, it was usable enough. All black pieces were present, but the number of white pieces was not correct.

A complete set of white chess pieces has 16 pieces: 1 king, 1 queen, 2 rooks, 2 bishops, 2 knights, and 8 pawns.

Given the number of white pieces Donghyuk found in that order, determine how many pieces of each type must be added or removed to make a complete set.

Input

The first line contains six integers: the numbers of white kings, queens, rooks, bishops, knights, and pawns that Donghyuk found, in that order.

Each integer is between 0 and 10, inclusive.

Output

Print six integers in the same order as the input. Each integer is the number of pieces of that type that must be added or removed.

A positive value means that many pieces must be added. A negative value means that many pieces must be removed.

Examples2

  1. Example 1

    Input
    0 1 2 2 2 7
    
    Expected output
    1 0 0 0 0 1
    
  2. Example 2

    Input
    2 1 2 1 2 1
    
    Expected output
    -1 0 0 1 0 7