func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1000005, mod = 1000000007;   int ar[N];   inline int lowbit(int x) { return x & (-x); }   void add(int i, int v) {     for (; i < N; i += lowbit(i)) {       ar[i] += v;       if (ar[i] >= mod) {         ar[i] %= mod;       }     }   }   int sum(int i) {     int res = 0;     for (; i > 0; i -= lowbit(i)) {       res += ar[i];       if (res >= mod) res %= mod;     }     return res;   }   int main() {     int n;     scanf( %d , &n);     memset(ar, 0, sizeof(ar));     for (int tp, i = 1; i <= n; i++) {       scanf( %d , &tp);       int s = sum(tp), v = ((long long)s * tp + tp) % mod, t = sum(tp - 1);       t = v - s + t;       if (t < 0) t += mod;       if (t >= mod) t %= mod;       add(tp, t);     }     printf( %d n , sum(N - 1));     return 0;   }   