Find the Punishment Number of an Integer

An integer i is a punishment number when the decimal representation of i * i can be partitioned into one or more contiguous substrings, in order, whose values sum to exactly i. The returned punishment number for n is the sum of i * i over every punishment number i with 1 <= i <= n.

For example, 36 * 36 = 1296 can be split as 1 | 29 | 6 with 1 + 29 + 6 = 36, so 36 contributes 1296.

Examples
Input: 1
Output: 1
Hints

Find the Punishment Number of an Integer

An integer `i` is a punishment number when the decimal representation of `i * i` can be partitioned into one or more contiguous substrings, in order, whose values sum to exactly `i`. The returned punishment number for `n` is the sum of `i * i` over every punishment number `i` with `1 <= i <= n`.