#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
inline char gc() {
  return getchar();
  static const int maxs = 1 << 16;
  static char buf[maxs], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, maxs, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long rd() {
  long long x = 0;
  char c = gc();
  bool neg = 0;
  while (c < '0' || c > '9') {
    if (c == '-') neg = 1;
    c = gc();
  }
  while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = gc();
  return neg ? (~x + 1) : x;
}
int N, a[maxn];
int x[maxn], y[maxn], z[maxn], ans[maxn];
inline void add() {
  memset(z, 0, sizeof(z));
  for (int i = 1; i <= max(y[0], x[0]); i++) z[i] = x[i] + y[i];
  z[0] = 0;
  for (int i = 1; i <= max(y[0], x[0]) + 1; i++) {
    z[i + 1] += z[i] / 10, z[i] %= 10;
    if (z[i]) z[0] = i;
  }
}
inline bool judge() {
  if (z[0] != ans[0]) return z[0] < ans[0];
  for (int i = z[0]; i; i--) {
    if (z[i] != ans[i]) return z[i] < ans[i];
  }
  return 0;
}
int main() {
  N = rd();
  for (int i = 1; i <= N; i++) a[N - i + 1] = getchar() - '0';
  ans[0] = 129381723;
  for (int i = N / 2, j = 3; i && j; i--) {
    if (!a[i]) continue;
    j--;
    memset(x, 0, sizeof(x)), memset(y, 0, sizeof(y));
    x[0] = i;
    for (int k = 1; k <= i; k++) x[k] = a[k];
    y[0] = N - i;
    for (int k = i + 1; k <= N; k++) y[k - i] = a[k];
    add();
    if (judge()) memcpy(ans, z, sizeof(z));
  }
  for (int i = N / 2 + 1, j = 3; i < N && j; i++) {
    if (!a[i]) continue;
    j--;
    memset(x, 0, sizeof(x)), memset(y, 0, sizeof(y));
    x[0] = i;
    for (int k = 1; k <= i; k++) x[k] = a[k];
    y[0] = N - i;
    for (int k = i + 1; k <= N; k++) y[k - i] = a[k];
    add();
    if (judge()) memcpy(ans, z, sizeof(z));
  }
  for (int i = ans[0]; i; i--) printf("%d", ans[i]);
  return 0;
}
