def convert_image(img, coefs):
    """Sum up image channels with weights from coefs array

    input:
    img -- 3-d numpy array (H x W x 3)
    coefs -- 1-d numpy array (length 3)
    output:
    img -- 2-d numpy array

    Not vectorized implementation.
    """    
    x = img.shape[0]
    y = img.shape[1]    
    res = [[0 for i in range(y)] for j in range(x)]
    for i in range(x):
        for j in range(y):
            for k in range(3):
                res[i][j] += img[i][j][k] * coefs[k]
    return res
    pass