count to keep track of the length of consecutive '1's.result to store the final count of substrings.s.count.count * (count + 1) / 2, add it to result, and reset count to 0.result with 1e9 + 7 after each addition.result as the final answer.