import itertools

def pagament_nomines(it, preu_hora, quant):
    it_p= map(lambda x:(x[0], x[1]*preu_hora), it)
    it1, it2, it3= itertools.tee(it_p, 3)
    it1= filter(lambda x: x[1] < quant, it1)
    it2= filter(lambda x:x[1]>= quant, it2)
    total= sum(map(lambda x:x[1], it3))
    return it1, it2, total
