E. Escape the Cube
time limit per test
0.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

The Cube (1997) is a science-fiction movie where some people are trapped in a mysterious cube-shaped room together. Some rooms contain traps that can kill people and they are to escape the cube without getting killed. After some exploration, they were able to discover the hidden patterns inside the cube and cracked the design of the cube. Given the hidden patterns, can you do the same?

The cube is sub-divided into uniquely-sized rooms. The dimension is $$$26 \times 26 \times 26$$$ rooms. Each room is represented by a serial of three numbers each having exactly 3 digits. The serial numbers never change. The sum of digits of each of the numbers give the initial $$$x$$$, $$$y$$$, and $$$z$$$ coordinates of the room. For example, the room 242 614 064 is initially located at the coordinate $$$(2+4+2, 6+1+4, 0+6+4) = (8,11,10)$$$. In case you are concerned, the coordinates are designed so that no rooms will end up having the same coordinates.

The difficult part about the cube is that the rooms will move from time to time, making it very hard to travel and escape the cube. The moving pattern of the cube is described below: For each movement, the three coordinates will move with the same rule. For the $$$i$$$-th move, if $$$i$$$ is not a multiple of 3, then the coordinates will change by the difference between the ($$$i \text{ mod } 3$$$)-th digit and the ($$$i \text{ mod } 3 + 1$$$)-th digit of the serial number; if $$$i$$$ is a multiple of 3, then the coordinates will change by the difference between the last digit and the first digit of the serial number. Please refer to the following examples for details. (Note that the following examples only show the effect of ONE particular move, but you will be required to simulate ALL moves in this task.)

Given the serial number of a room, the number of movements $$$M$$$, determine the final location of the room.

Input

The first line contains the serial number of the room. It is represented by 3 strings that contains 3 digits each.

The second line contains an integer $$$M$$$ – the number of movements. ($$$0 \le M \le 10^{18}$$$)

Output

Output 3 integers representing the $$$x$$$, $$$y$$$ and $$$z$$$ coordinates of the final position of the room after the $$$M$$$-th movement.

Examples
Input
242 614 064
0
Output
8 11 10
Input
242 614 064
1
Output
6 16 4
Input
456 111 232
1000000
Output
14 3 6
Note

Samples 1 and 2 show that the room moved by $$$(-2, 5, -6)$$$ for the 1st movement.