forked from: Lagrange polynomial