#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   set<int> a, b;   set<int> pre;   char str[10];   int main() {     int n;     cin >> n;     long long ans = 1;     a.insert(0);     b.insert(1e9 + 5);     for (int i = 0; i < n; ++i) {       int x;       scanf( %s%d , str, &x);       if (str[1] ==  D ) {         int l = *a.rbegin();         int r = *b.begin();         if (x > l && x < r) {           pre.insert(x);         } else {           if (x < l)             a.insert(x);           else             b.insert(x);         }       } else {         if (pre.count(x)) {           ans *= 2;           ans %= mod;           for (auto it : pre) {             if (it > x)               b.insert(it);             else if (it < x)               a.insert(it);           }           pre.clear();         } else {           int l = *a.rbegin();           int r = *b.begin();           if (x == l) {             a.erase(x);             for (auto it : pre) {               if (it != x) b.insert(it);             }           } else if (x == r) {             b.erase(x);             for (auto it : pre) {               if (it != x) a.insert(it);             }           } else             return puts( 0 );           pre.clear();         }       }     }     int x = pre.size();     ans *= (x + 1);     ans %= mod;     cout << ans << endl;     return 0;   }   