func_code_string: #include <bits/stdc++.h>   using namespace std;   long long h[1000010], dp[1000010][2];   int n;   int main() {     int i, j;     while (scanf( %d , &n) != EOF) {       for (i = 1; i <= n; i++) scanf( %lld , &h[i]), h[i]--;       for (i = 1; i <= n; i++) {         dp[i][0] = (dp[i - 1][0] + dp[i - 1][1] * min(h[i], h[i - 1]) + h[i]) %                    1000000007;         dp[i][1] = (min(h[i + 1], h[i]) +                     min(min(h[i], h[i - 1]), h[i + 1]) * dp[i - 1][1]) %                    1000000007;       }       printf( %d n , dp[n][0]);     }     return 0;   }   