itertools.product() hackerrank solution python