func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const long long llinf = 0x3f3f3f3f3f3f3f3f;   template <typename INint>   inline void IN(INint &first) {     first = 0;     int f = 1;     char c;     cin.get(c);     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       cin.get(c);     }     while (c >=  0  && c <=  9 ) {       first = first * 10 + c -  0 ;       cin.get(c);     }     first *= f;   }   template <typename INint>   inline void OUT(INint first) {     if (first > 9) OUT(first / 10);     cout.put(first % 10 +  0 );   }   const int maxn = int(4e5);   int mod = int(1e9 + 7);   int n;   int mn = -inf, mx = inf;   set<int> A;   int gtype(int first) {     if (first < mn) return 0;     if (first > mx) return 4;     if (first == mn) return 1;     if (first == mx) return 3;     return 2;   }   void mul(long long &a, long long b) {     a *= b;     if (a > mod) a %= mod;   }   int main() {     int T(1), times(0);     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     while (++times, T--) {       cin >> n;       A.insert(mx);       A.insert(mn);       long long res(1), ans(1);       for (int i = 1; i <= int(n); i++) {         int no;         string s;         cin >> s >> no;         int p = gtype(no);         if (s[1] ==  D ) {           A.insert(no);           if (p == 2) ++res;         } else {           if (p == 0 || p == 4) {             cout << 0 << endl;             return 0;           }           if (p == 2) mul(ans, 2);           A.erase(no);           res = 1;           auto pos = A.lower_bound(no);           mx = *pos;           mn = *(--pos);         }       }       ans *= res;       ans %= mod;       cout << ans << endl;     }     return 0;   }   