#include <bits/stdc++.h>
using namespace std;
vector<int> add(vector<int> &a, vector<int> &b) {
  vector<int> ans(max(a.size(), b.size()) + 1);
  int t = 0;
  int n = min(a.size(), b.size());
  for (int i = 0; i < n; i++) {
    ans[i] = (t + a[i] + b[i]) % 10;
    t = (t + a[i] + b[i]) / 10;
  }
  if (a.size() == b.size()) {
    ans[n] = t;
    return ans;
  }
  vector<int>::iterator r = ans.begin() + n;
  vector<int>::iterator c;
  if (a.size() > b.size())
    c = a.begin() + b.size();
  else
    c = b.begin() + a.size();
  while (c != a.end() && c != b.end()) {
    *r = (*c + t) % 10;
    t = (*c + t) / 10;
    c++;
    r++;
  }
  *r = t;
  return ans;
}
void print(vector<int> a) {
  int t = a.size() - 1;
  while (a[t] == 0) t--;
  for (int i = t; i >= 0; i--) cout << a[i];
  cout << "\n";
}
bool cmp(vector<int> &a, vector<int> &b) {
  if (a.size() > b.size()) return 1;
  if (b.size() > a.size()) return 0;
  for (int i = a.size() - 1; i >= 0; i--) {
    if (a[i] > b[i]) return 1;
    if (a[i] < b[i]) return 0;
  }
  return 1;
}
int main() {
  int l;
  cin >> l;
  vector<int> x(l);
  for (int i = l - 1; i >= 0; --i) {
    char tmp;
    cin >> tmp;
    x[i] = tmp - '0';
  }
  if (l & 1 == 0 && x[l / 2 - 1] != 0) {
    vector<int> a(l / 2), b(l / 2);
    for (int i = 0; i < l / 2; i++) a[i] = x[i];
    for (int i = l / 2; i < l; i++) b[i - l / 2] = x[i];
    print(add(a, b));
  } else {
    int t = l / 2 - 1;
    while (t >= 0 && x[t] == 0) t--;
    vector<int> c1;
    if (t < 0) {
      c1 = x;
    } else {
      vector<int> a(t + 1), b(l - t - 1);
      for (int i = 0; i < t + 1; i++) a[i] = x[i];
      for (int i = t + 1; i < l; i++) b[i - t - 1] = x[i];
      c1 = add(a, b);
    }
    t = l / 2;
    while (t < x.size() && x[t] == 0) t++;
    vector<int> c2;
    if (t == x.size()) {
      c2 = x;
    } else {
      vector<int> a(t + 1), b(l - t - 1);
      for (int i = 0; i < t + 1; i++) a[i] = x[i];
      for (int i = t + 1; i < l; i++) b[i - t - 1] = x[i];
      c2 = add(a, b);
    }
    if (cmp(c1, c2) == 0)
      print(c1);
    else
      print(c2);
  }
  return 0;
}
