import math


def getPMI(n, x, y, N):
    """
    Compute the weighted PMI value. 
    """
    pmi =  math.log((float(n) * float(N)) / (float(x) * float(y)))
    res = pmi * (float(n) / float(N))
    return 0 if res < 0 else res