Click here to read the complete problem statement.
guyzzzzz give some hint on doing this one am too dumb