#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MN = 100010;

int N;
int A[MN];
char B[MN];
ll dp[MN][3];

int main() {
    scanf("%d", &N);

    for(int i = 0; i < N; i++) {
        if(i) {
            scanf(" %c", &B[i]);
        }
        scanf("%d", &A[i]);
    }

    if(N == 1) {
        printf("%d", A[0]);
        return 0;
    }

    dp[N - 1][0] = B[N - 1] == '+'? A[N - 1] : -A[N - 1];
    dp[N - 1][1] = B[N - 1] == '+'? -A[N - 1] : A[N - 1];
    dp[N - 1][2] = abs(A[N - 1]);

    for(int i = N - 2; i >= 1; i--) {
        if(B[i] == '+') {
            dp[i][0] = dp[i + 1][0] + A[i];
            dp[i][1] = -1e18;
            dp[i][2] = -1e18;
            for(int j = 0; j < 3; j++) {
                dp[i][1] = max(dp[i][1], dp[i + 1][j] - A[i]);
                dp[i][2] = max(dp[i][2], dp[i + 1][j] + abs(A[i]));
            }
        }
        else {
            dp[i][0] = -1e18;
            dp[i][1] = -1e18;
            dp[i][2] = -1e18;
            for(int j = 0; j < 3; j++) {
                if(j < 2) dp[i][0] = max(dp[i][0], dp[i + 1][j] - A[i]);
                dp[i][1] = max(dp[i][1], dp[i + 1][j] + A[i]);
                dp[i][2] = max(dp[i][2], dp[i + 1][j] + abs(A[i]));
            }
        }

        //cout << i << ' ' << dp[i][0] << ' ' << dp[i][1] << ' ' << dp[i][2] << endl;
    }

    printf("%lld", dp[1][0] + A[0]);
}
