Finding a specific funcion with parameters given, tough seeming question

Heres the question, I have tried to construct such a function, but I keep having trouble making it so both conditions are met, I seem to only be able to manufacture a function that works for one of the conditions, or the other, but not both simultaneous. I dont need a full blown answer, but I would definantly like some guidence as to where to go next:

If are distinct numbers, find a polynomial function of degree which is at and at for .

The question also gives a hint:

The product of all for , is at if .

Thank you for any help on this question that anybody can give.