# Task
 In ChessLand there is a small but proud chess bishop with a recurring dream. 
 In the dream the bishop finds itself on an `n × m` chessboard with mirrors along each edge, and it is not a bishop but a ray of light. This ray of light moves only along diagonals (the bishop can't imagine any other types of moves even in its dreams), it never stops, and once it reaches an edge or a corner of the chessboard it reflects from it and moves on.
 Given the initial position and the direction of the ray, find its position after `k` steps where a step means either moving from one cell to the neighboring one or reflecting from a corner of the board.
# Example
 For `boardSize = [3, 7], initPosition = [1, 2], initDirection = [-1, 1] and k = 13,` the output should be `[0, 1]`.
 Here is the bishop's path:
```
[1, 2] -> [0, 3] -(reflection from the top edge)
         -> [0, 4] -> [1, 5] -> [2, 6] -(reflection from the bottom right corner)
         -> [2, 6] ->[1, 5] -> [0, 4] -(reflection from the top edge)
         -> [0, 3] ->[1, 2] -> [2, 1] -(reflection from the bottom edge)
         -> [2, 0] -(reflection from the left edge)
         -> [1, 0] -> [0, 1]```
 ![](https://codefightsuserpics.s3.amazonaws.com/tasks/chessBishopDream/img/example.png?_tm=1472324389202)
# Input/Output
 - `[input]` integer array `boardSize`
    An array of two integers, the number of `rows` and `columns`, respectively. Rows are numbered by integers from `0 to boardSize[0] - 1`, columns are numbered by integers from `0 to boardSize[1] - 1` (both inclusive).
    Constraints: `1 ≤ boardSize[i] ≤ 20.`
 - `[input]` integer array `initPosition`
    An array of two integers, indices of the `row` and the `column` where the bishop initially stands, respectively.
    Constraints:  `0 ≤ initPosition[i] < boardSize[i]`.
 - `[input]` integer array `initDirection`
    An array of two integers representing the initial direction of the bishop. 
    If it stands in `(a, b)`, the next cell he'll move to is `(a + initDirection[0], b + initDirection[1])` or whichever it'll reflect to in case it runs into a mirror immediately.
    Constraints: `initDirection[i] ∈ {-1, 1}`.
 - `[input]` integer `k`
    Constraints: `1 ≤ k ≤ 1000000000`.
 - `[output]` an integer array
    The position of the bishop after `k` steps.
def chess_bishop_dream(b,p,d,k):
    yq,yr=divmod(p[0]+k*d[0],b[0])
    xq,xr=divmod(p[1]+k*d[1],b[1])
    if yq<0:
        yq=-yq
        yr=b[0]-yr-1
    if xq<0:
        xq=-xq
        xr=b[1]-xr-1
    return [(b[0]-yr-1 if yq%2==(d[0]>0) else yr),(b[1]-xr-1 if xq%2==(d[1]>0) else xr)]

def chess_bishop_dream(b,p,d,k):
    yq,yr=divmod(p[0]+k*d[0],b[0])
    xq,xr=divmod(p[1]+k*d[1],b[1])
    if yq<0:
        yq=-yq
        yr=b[0]-yr-1
    if xq<0:
        xq=-xq
        xr=b[1]-xr-1
    return [(b[0]-yr-1 if yq%2==(d[0]>0) else yr),(b[1]-xr-1 if xq%2==(d[1]>0) else xr)]
