Author: | Антон Карабанов | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
Timofey has two semi-transparent films with a gray-and-white checkered pattern, each of size n × n. The first film has a cell size of 1 × 1, and the second film has a cell size of a × a. Both films start with a gray square in the top-left corner.
Today, Timofey placed the two films on top of each other. As a result:
Where gray squares from both films overlapped, the color turned black.
Where gray squares overlapped with white squares, the color remained gray.
Where white squares overlapped with white squares, the color remained white.
Your task is to determine how many single-unit squares of black, gray, and white color there are in total.
The input consists of two natural numbers, a and n.
The output should be three natural numbers — the number of black, gray, and white unit squares.
2 ≤ a < n ≤ 109
See the diagram for an example of tiling.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|