'use strict'

function main(s) {

  s = s.split('\n');

  const W = Number(s[0]);
  const H = 2;

  const table = s.slice(1, -1).map(l => l.split(' ').map(n => Number(n)));
  const max   = [...Array(H)].map(l => [...Array(W)].fill('#'));

  const que = [];
  const dh = [0, 1];
  const dw = [1, 0];

  que.push([0, 0]);
  max[0][0] = table[0][0];

  while (que.length > 0) {
    const p = que.shift();

    for (let i = 0; i < 2; i++) {
      const nh = p[0] + dh[i];
      const nw = p[1] + dw[i];
      if (nh < 0 || H <= nh) continue;
      if (nw < 0 || W <= nw) continue;

      que.push([nh, nw]);

      const prev = max[nh][nw];
      const next = max[p[0]][p[1]] + table[nh][nw];

      max[nh][nw] = (prev === '#') ? next : Math.max(prev, next);
    }
  }

  const ans = max[1][W - 1];
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
