import numpy as np
def linear_regression_normal_equation(X: list[list[float]], y: list[float]) -> list[float]:
    # 实现代码
    X_train = np.array(X)
    Y_train = np.array(y)

    coe = np.linalg.inv(X_train.T @X_train) @ X_train.T @ Y_train
    
    w = round(float(coe[0]), 4)
    b = round(float(coe[1]), 4)
    return [w, b]

if __name__ == "__main__":
    import ast
    x = np.array(ast.literal_eval(input()))
    y = np.array(ast.literal_eval(input())).reshape(-1, 1)

    # Perform linear regression
    coefficients = linear_regression_normal_equation(x, y)

    # Print the coefficients
    print(coefficients)