#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  vector<int> v1, v2;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (abs(a[i]) % 2 == 0) {
      v2.push_back(a[i]);
    } else {
      v1.push_back(a[i]);
    }
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  long long R = 0;
  for (int i = 0; i < v2.size(); i++) {
    if (v2[i] > 0) R += v2[i];
  }
  int ok = 0, f = 0, id = -1;
  int minx = 1e9;
  for (int i = 0; i < v1.size(); i++) {
    if (v1[i] >= 0) {
      ok++;
      R += v1[i];
      minx = min(minx, v1[i]);
      if (id == -1) id = i;
    }
  }
  if (ok % 2 == 0) {
    if (id > 0) {
      cout << max(R - minx, R + v1[id - 1]);
    } else {
      if (v1.size() > 0) {
        int h = -1e9;
        for (int i = 0; i < v1.size(); i++) {
          if (v1[i] >= 0) break;
          h = v1[i];
        }
        cout << max(R - minx, R + h);
      }
    }
  } else {
    cout << R;
  }
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

You are given sequence a1, a2, ..., an of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.

Subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.

You should write a program which finds sum of the best subsequence.

Input

The first line contains integer number n (1 ≤ n ≤ 105).

The second line contains n integer numbers a1, a2, ..., an ( - 104 ≤ ai ≤ 104). The sequence contains at least one subsequence with odd sum.

Output

Print sum of resulting subseqeuence.

Examples

Input

4
-2 2 -3 1


Output

3


Input

3
2 -5 -3


Output

-1

Note

In the first example sum of the second and the fourth elements is 3.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  vector<int> v1, v2;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (abs(a[i]) % 2 == 0) {
      v2.push_back(a[i]);
    } else {
      v1.push_back(a[i]);
    }
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  long long R = 0;
  for (int i = 0; i < v2.size(); i++) {
    if (v2[i] > 0) R += v2[i];
  }
  int ok = 0, f = 0, id = -1;
  int minx = 1e9;
  for (int i = 0; i < v1.size(); i++) {
    if (v1[i] >= 0) {
      ok++;
      R += v1[i];
      minx = min(minx, v1[i]);
      if (id == -1) id = i;
    }
  }
  if (ok % 2 == 0) {
    if (id > 0) {
      cout << max(R - minx, R + v1[id - 1]);
    } else {
      if (v1.size() > 0) {
        int h = -1e9;
        for (int i = 0; i < v1.size(); i++) {
          if (v1[i] >= 0) break;
          h = v1[i];
        }
        cout << max(R - minx, R + h);
      }
    }
  } else {
    cout << R;
  }
}

```