#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long int ld;
 
mt19937 rnd(time(0));
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pNN pair <Node *, Node *>
#define SZ(x) (int)(x).size()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pb push_back
#define ins insert
#define ers erase
#define S second
#define F first
#define int ll
constexpr int N = 510;
const ll M = 998244353;

struct Op {
    char type;
    int num;
};

Op a[N];
int b[N];
int n;
ll dp[N][N];

int calc_dp(int ind) {
    for (int i = 0; i <= n + 5; ++i) {
        for (int j = 0; j <= n + 5; ++j) {
            dp[i][j] = 0;
        }
    }
    if (b[0] == 1) {
        dp[0][0] = 1;
        dp[0][1] = 1;
    } else if (b[0] == 0) {
        dp[0][0] = 1;
    } else {
        dp[0][0] = 2;
    }
    for (int i = 1; i < ind; ++i) {
        for (int cnt = 0; cnt <= n; ++cnt) {
            if (b[i] == 2) {
                dp[i][cnt] = dp[i - 1][cnt] * 2;
            }
            if (b[i] == 1) {
                dp[i][cnt] = (cnt > 0 ? dp[i - 1][cnt - 1] : 0) + dp[i - 1][cnt]; 
            }
            if (b[i] == -1) {
                if (cnt == 0) {
                    dp[i][cnt] = dp[i - 1][cnt] * 2 + dp[i - 1][cnt + 1];
                } else {
                    dp[i][cnt] = dp[i - 1][cnt] + dp[i - 1][cnt + 1];
                }
            }
            dp[i][cnt] %= M;
        }
    }
    if (ind > 0) {
        for (int cnt = 0; cnt <= n; ++cnt) {
            dp[ind][cnt] = dp[ind - 1][cnt];
        }
    }
    for (int i = ind + 1; i < n; ++i) {
        for (int cnt = 0; cnt <= n; ++cnt) {
            if (b[i] == 2) {
                dp[i][cnt] = dp[i - 1][cnt] * 2;
            }
            if (b[i] == 1) {
                dp[i][cnt] = (cnt > 0 ? dp[i - 1][cnt - 1] : 0) + dp[i - 1][cnt]; 
            }
            if (b[i] == -1) {
                dp[i][cnt] = dp[i - 1][cnt] + dp[i - 1][cnt + 1];
            }
            dp[i][cnt] %= M;
        }
    }
    ll sum = 0;
    for (int cnt = 0; cnt <= n; ++cnt) {
        sum += dp[n - 1][cnt];
        sum %= M;
    }
    return sum;
}


int get_ans(int ind) {
    for (int i = 0; i < ind; ++i) {
        if (a[i].type == '-') {
            b[i] = -1;
        } else {
            if (a[i].num > a[ind].num) {
                b[i] = 2;
            } else {
                b[i] = 1;
            }
        }
    } 
    b[ind] = 0;
    for (int i = ind + 1; i < n; ++i) {
        if (a[i].type == '-') {
            b[i] = -1;
        } else {
            if (a[i].num >= a[ind].num) {
                b[i] = 2;
            } else {
                b[i] = 1;
            }
        }
    }
    return calc_dp(ind);
}


void solve() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].type;
        if (a[i].type == '+') {
            cin >> a[i].num;
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i].type == '+') {
            ans += (get_ans(i) * (a[i].num % M)) % M;
            ans %= M;
        }
    }
    cout << ans << '\n';
}   
 
signed main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    #ifdef fleek$
        assert(freopen("input.txt", "r", stdin));
    #endif
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}