import math
import numpy as np


def single_neuron_model(features, labels, weights, bias):
    forward = np.dot(features, weights) + bias
    predictions = 1 / (1 + math.e ** (-forward))
    probabilities = [round(p, 4) for p in predictions]
    mse = round(np.sum((predictions - labels) ** 2) / len(labels), 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))