def matrix_vector_dot_product(matrix, vector):
    # matrix is not null
    if not matrix:
        return -1
    # maatrix cols need to equal to vector len
    if len(matrix[0]) != len(vector):
        return -1
    # every row need to have same len
    for row in matrix:
        if len(row) != len(matrix[0]):
            return -1
    # Dot
    result = []
    for row in matrix:
        dot_product = 0
        for i in range(len(matrix[0])):
            dot_product += row[i] * vector[i]
        result.append(dot_product)
    return result
# 主程序
if __name__ == "__main__":
    # 输入矩阵和向量
    matrix_input = input()
    vector_input = input()

    # 处理输入
    import ast
    matrix = ast.literal_eval(matrix_input)
    vector = ast.literal_eval(vector_input)

    # 调用函数计算点积
    output = matrix_vector_dot_product(matrix, vector)
    
    # 输出结果
    print(output)