def repl(elt, req, eq):
    r = req.copy()
    q = (r[elt] // eq['qte'])
    if ((r[elt] % eq['qte']) != 0):
        q += 1
    for i in eq['inp']:
        if (i not in r):
            r[i] = 0
        r[i] += (q * eq['inp'][i])
    r[elt] -= (q * eq['qte'])
    return r
def repl(elt, req, eq):
    r = req.copy()
    q = (r[elt] // eq['qte'])
    if ((r[elt] % eq['qte']) != 0):
        q += 1
    for i in eq['inp']:
        if (i not in r):
            r[i] = 0
        r[i] += (q * eq['inp'][i])
    r[elt] -= (q * eq['qte'])
    return r