# Créé par nyckie, le 08/01/2019 en Python 3.4
from random import*
from math import*
def simvar(V,P,n):
    N=[0,0,0,0]
    y=P[0]
    z=y+P[1]
    t=z+P[2]
    for i in range(n):
        a=random()
        if 0<a<y:
            N[0]=N[0]+1
        if y<a<z:
            N[1]=N[1]+1
        if z<a<t:
            N[2]=N[2]+1
        if a>t:
            N[3]=N[3]+1
    F=[N[0]/n,N[1]/n,N[2]/n,N[3]/n]
    return(F)


def moysimvar(V,P,n):
    E=0
    F=simvar(V,P,n)
    for i in range(4):
        E=E+V[i]*F[i]
    return E


















def moysimvar(V,P,n):
    E=0
    F=simvar(V,P,n)
    for i in range(4):
        E=E+V[i]*F[i]
    return E
