import math
import numpy as np
def single_neuron_model(features, labels, weights, bias):
    X = np.asarray(features,dtype=float)
    y = np.asarray(labels,dtype=float).reshape(-1)
    m,n = X.shape
    X_1 = np.hstack([X,np.ones((m,1))])
    theta = np.hstack([weights,bias])
    z = X_1 @ theta
    probabilities = np.round(sigmoid(z),4).tolist()
    mse = np.mean((probabilities - y) ** 2)
    mse = np.round(mse,4)
    #theta = weights and bias 
    #pre = features dots theta
    #mse = pre - labels
    return probabilities, mse


def sigmoid(x):
    return  1 / (1 + np.exp(-x)) 

if __name__ == "__main__":
    features = np.array(eval(input()))
    labels = np.array(eval(input()))
    weights = np.array(eval(input()))
    bias = float(input())
    print(single_neuron_model(features, labels, weights, bias))