#include <bits/stdc++.h>
using namespace std;
bool compare(vector<short> &a1, vector<short> &a2, int n1, int n2) {
  if (n1 != n2) {
    return n1 < n2;
  }
  for (int i = 0; i < n1; i++) {
    if (a1[i] != a2[i]) {
      return a1[i] < a2[i];
    }
  }
  return true;
}
void sum(short a[], int pivot, int n, vector<short> &x, int size) {
  short s = 0;
  for (int i = 0; i < size; i++) {
    if (pivot - i - 1 >= 0) {
      s += a[pivot - i - 1];
    }
    if (n - i - 1 >= pivot) {
      s += a[n - i - 1];
    }
    x[i] = s % 10;
    s /= 10;
  }
  reverse(x.begin(), x.end());
}
int main() {
  int n;
  cin >> n;
  short a[n];
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    a[i] = c - '0';
  }
  int minimum = n;
  int pivot = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] != 0) {
      if (minimum > max(i, n - i)) {
        minimum = max(i, n - i);
        pivot = i;
      } else if (minimum == max(i, n - i)) {
        int n1 = max(i, n - i) + 1;
        int n2 = max(pivot, n - pivot) + 1;
        vector<short> a1(n1);
        vector<short> a2(n2);
        sum(a, i, n, a1, n1);
        sum(a, pivot, n, a2, n2);
        if (compare(a1, a2, n1, n2)) {
          pivot = i;
        }
      }
    }
  }
  int size = max(pivot, n - pivot) + 1;
  vector<short> answear(size);
  sum(a, pivot, n, answear, size);
  int i = 0;
  while (answear[i] == 0) {
    i++;
  }
  for (; i < size; i++) {
    cout << answear[i];
  }
}
