"use strict";

const main = arg => {
  arg = arg.trim().split(/\s+/).map(x=>x-0);
  const N = arg.shift();
  const A = [];
  const B = [];
  
  while(arg.length>0){
    B.push(arg.pop());
    A.push(arg.pop());
  }
  
  const M = Math.max.apply(null,A);
  const S = B[A.indexOf(M)];

  console.log(M + S);
}
main(require('fs').readFileSync('/dev/stdin','utf8'));
