def solution(n: str = N) -> int:

    largest_product = -sys.maxsize - 1
    substr = n[:13]
    cur_index = 13
    while cur_index < len(n) - 13:
        if int(n[cur_index]) >= int(substr[0]):
            substr = substr[1:] + n[cur_index]
            cur_index += 1
        else:
            largest_product = max(largest_product, str_eval(substr))
            substr = n[cur_index : cur_index + 13]
            cur_index += 13
    return largest_product