You are given an 8x8 grid where the rows are numbered from 0 to 7 from top to bottom, and the columns are numbered from 0 to 7 from left to right. A knight is positioned at cell (a, b) on the grid. The knight can move according to the standard chess knight rules, which are as follows:
The knight can move in an L shape, taking two steps in one direction (horizontally or vertically) and then one step perpendicular to the previous direction.
The knight cannot move outside the boundaries of the 8x8 grid.
Each knight move has a cost. The cost of moving the knight from position to position is defined as y⋅r + x⋅c.
Given the initial position of the knight at cell (a, b), your task is to calculate and output the minimum cost required to move the knight from position (a, b) to every other cell on the grid.
Write a program that takes the initial position of the knight and outputs the minimum cost for each cell on the grid.
Input
The input consists of a single line containing two space-separated integers, a and b (0 ≤ a, b ≤ 7), representing the initial position of the knight.
Output
Output eight lines, each containing eight space-separated integers. The i-th integer in the j-th line represents the minimum cost required to move the knight from position (a, b) to position (i, j) on the 8x8 grid.