import math
import numpy as np
def sigmoid(x):
    return 1/(1+np.exp(-x))
def single_neuron_model(features, labels, weights, bias):
    single = np.dot(features,weights)+bias
    pred = sigmoid(single)
    probabilities = np.round(pred,4).tolist()
    mse = np.sum((pred-labels)**2)/len(pred)
    mse = np.round(mse,4)

    return probabilities, mse


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))