#!/usr/bin/python import sys; import math; import os def nDigitProduct(num,offset,digits): sum = 1; for i in range(offset,offset+digits): sum *= int(num[i]); return sum; def greatestProduct(num,digits): higherProduct = 0; for i in range (0, len(num)-(digits-1)): product = nDigitProduct(num,i,digits); if(product > higherProduct): higherProduct = product; return higherProduct; strNum = "".join(sys.stdin.readlines()).replace('\n','') numDigits = int(sys.argv[1]) print "Result is: " + str(greatestProduct(strNum,numDigits));