def sum_links(corpus, prob_dist, page):
    """
    Returns sum of prob_dist[i]/len(corpus[i]) where i ranges over all pages that link to 'page'
    """
    total = 0
    for i in corpus:
        if page in corpus[i]:
            total += prob_dist[i] / len(corpus[i])
    return total