human
Alice and Bob have decided to play the game "Rock, Paper, Scissors". 

The game consists of several rounds, each round is independent of each other. In each round, both players show one of the following things at the same time: rock, paper or scissors. If both players showed the same things then the round outcome is a draw. Otherwise, the following rules applied:

  * if one player showed rock and the other one showed scissors, then the player who showed rock is considered the winner and the other one is considered the loser.

  * if one player showed scissors and the other one showed paper, then the player who showed scissors is considered the winner and the other one is considered the loser.

  * if one player showed paper and the other one showed rock, then the player who showed paper is considered the winner and the other one is considered the loser. 


Alice and Bob decided to play exactly n rounds of the game described above. Alice decided to show rock a_1 times, show scissors a_2 times and show paper a_3 times. Bob decided to show rock b_1 times, show scissors b_2 times and show paper b_3 times. Though, both Alice and Bob did not choose the sequence in which they show things. It is guaranteed that a_1 + a_2 + a_3 = n and b_1 + b_2 + b_3 = n.

Your task is to find two numbers:

  1. the minimum number of round Alice can win.

  2. the maximum number of rounds Alice can win. 

Input

The first line of the input contains one integer n (1 ≤ n ≤ 10^{9}) — the number of rounds.

The second line of the input contains three integers a_1, a_2, a_3 (0 ≤ a_i ≤ n) — the number of times Alice will show rock, scissors and paper, respectively. It is guaranteed that a_1 + a_2 + a_3 = n.

The third line of the input contains three integers b_1, b_2, b_3 (0 ≤ b_j ≤ n) — the number of times Bob will show rock, scissors and paper, respectively. It is guaranteed that b_1 + b_2 + b_3 = n.

Output

Print two integers: the minimum and the maximum number of rounds Alice can win.

Examples

Input

2
0 1 1
1 1 0

Output

0...
Using python3 can you solve the prior task?
assistant
#Here is Python program to find two numbers:
.

from __future__ import division, print_function
from io import BytesIO, IOBase
import os,sys,math,heapq,copy
from collections import defaultdict,deque,Counter
from bisect import bisect_left,bisect_right
from functools import cmp_to_key
from itertools import permutations,combinations,combinations_with_replacement
# <fastio>
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
    """Prints the values to a...