#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#ifdef XLor
#define dbg(args...) cout << #args << " -> ", err(args)
void err() { std::cout  << std::endl; }
template<typename T, typename...Args>
void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
#define dbg(...)
#endif
using ll = long long;
using namespace std;
const int N = 555;
const int Mod = 998244353;
ll a[N],F[N][N],G[N][N];
ll Ans = 0;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    for(int i=1;i<=n;++i){
        char c;
        cin >> c;
        if(c=='+') cin >> a[i];
    }
    for(int i = 1; i <= n; i++){
        if (a[i]){
            memset(F,0,sizeof F);
            F[0][0] = 1;
            for(int j = 1; j < i; j++){
                for(int k = 0; k <= n; k++)
                    F[j][k] = F[j - 1][k];
                if (a[j]){
                    for(int k = 0; k <= n; k++){
                        int cnt = (a[j] < a[i]);
                        (F[j][k + cnt] += F[j - 1][k]) %= Mod;
                    }
                }
                else{
                    (F[j][0] += F[j - 1][0]) %= Mod;
                    for(int k = 1; k <= n; k++){
                        (F[j][k - 1] += F[j - 1][k]) %= Mod;
                    }
                }
            }
            for(int j = 0; j <= n; j++) {
                F[i][j] = F[i - 1][j];
            }
            for(int j = i + 1; j <= n; j++){
                for(int k = 0; k <= n; k++)
                    F[j][k] = F[j - 1][k];
                if (a[j]){
                    for(int k = 0; k <= n; k++){
                        int cnt = (a[j] <= a[i]);
                        (F[j][k + cnt] += F[j - 1][k]) %= Mod;
                    }
                }
                else{
                    for(int k = 1; k <= n; k++){
                        (F[j][k - 1] += F[j - 1][k]) %= Mod;
                    }
                }
            }
            ll sum = 0;
            for(int k = 0; k <= n; k++){
                (sum += F[n][k]) %= Mod;
            }
            dbg(sum);
            Ans = (Ans + sum * a[i] % Mod) % Mod;
        }
    }
    cout << Ans <<"\n";
}