#include <bits/stdc++.h>   const int MAX_N = 1000000;   const int MOD = 1000000007;   std::vector<int> groups;   int table[1 + MAX_N], dp[1 + MAX_N];   std::deque<int> tablePositions;   int main() {     std::string s;     std::cin >> s;     groups.push_back(0);     int cnt = 0;     for (int i = 0; i < s.size(); ++i)       if (s[i] ==  0 )         ++cnt;       else {         groups.push_back(cnt);         cnt = 0;       }     groups.push_back(cnt);     dp[1] = groups[1] + 1;     for (int i = 2; i < groups.size(); ++i) {       if (i < groups.size() - 1) dp[i] = dp[i - 1];       for (int lastDigit = 0; lastDigit <= groups[i]; ++lastDigit) {         dp[i] = (dp[i] + dp[i - 1]) % MOD;         while (!tablePositions.empty() && tablePositions.front() < lastDigit)           tablePositions.pop_front();         if (i < groups.size() - 1 && !tablePositions.empty())           dp[i] = (dp[i] + MOD - table[tablePositions.front()]) % MOD;       }       tablePositions.push_front(groups[i]);       table[groups[i]] = dp[i - 1];     }     if (groups.size() == 2) dp[groups.size() - 1]--;     printf( %d , dp[groups.size() - 1]);     return 0;   }   