import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class No0294 { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { int n = in.nextInt(); int cnt = 0; ArrayList num = new ArrayList<>(); for (int i=0; i 0) { max -= num.get(i); cnt--; } else { max += num.get(i); } } max += x; cnt = tmp; long min = 0; if (cnt > 0) { min -= x; cnt--; } else { min += x; } for (int i=nn-2; i>=0; i--) { if (cnt > 0) { min -= num.get(i); cnt--; } else { min += num.get(i); } } out.println(max + " " + min); } public static void main(String[] args) { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); in.close(); out.close(); } static void trace(Object... o) { System.out.println(Arrays.deepToString(o));} }