import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	static long s3(long x) { return x * x * x; }

	static Pair bt(long M)
	{
		if(M == 0)
			return new Pair();
		int a = 1; while(s3(a + 1) <= M) ++a;
		Pair p1 = bt(Math.min(M, s3(a + 1) - 1) - s3(a));
		p1.inc(a);
		if(a > 1)
		{
			Pair p2 = bt(Math.min(M, s3(a) - 1) - s3(a - 1));
			p2.inc(a - 1);
			p1 = combine(p1, p2);
		}
		return p1;
	}

	public static void main(String[] args) throws IOException
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Pair ans = bt(sc.nextLong());
		out.println(ans.maxCnt + " " + ans.maxX);

		out.flush();
		out.close();
	}

	static Pair combine(Pair p1, Pair p2)
	{
		if(p1.maxCnt > p2.maxCnt || p1.maxCnt == p2.maxCnt && p1.maxX > p2.maxX)
			return p1;
		return p2;
	}

	static class Pair
	{
		long maxX; int maxCnt;

		void inc(long a) { maxCnt++; maxX += s3(a); }
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader r){	br = new BufferedReader(r);}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}

	}
}


import static java.lang.System.currentTimeMillis;

import java.io.*;
import java.util.*;

public class D {

    static void solve() throws IOException {
        // while (true) {
        // testWithVsWithout();
        // if (false) {
        // break;
        // }
        // }
        // test();
        int n = nextInt(), m = nextInt();
//      long time = currentTimeMillis();
        long answer = solve(n, m);
//      System.err.println(currentTimeMillis() - time);
        out.println(answer);
    }

    static void test() {
        for (int n = 1; n < 100; n++) {
            for (int m = 0; 2 * m <= n; m++) {
                long got = solve(n, m);
                long stup = solveStupid(n, m);
                if (got != stup) {
                    throw new AssertionError();
                }
            }
        }
        System.err.println("pass");
    }

    static void testWithVsWithout() {
        Random rng = new Random();
        int n = rng.nextInt(32001);
        while (n < 5) {
            n = rng.nextInt(32001);
        }
        int m = rng.nextInt(n / 2);
        long got = solve(n, m);
        long stup = solveWithoutOptimizations(n, m);
        if (got != stup) {
            throw new AssertionError();
        }
        System.err.println("pass");
    }

    private static long solve(int n, int m) {
        Point[] pointsLeft = new Point[n];
        Point[] pointsRight = new Point[n];
        for (int i = 0; i < n; i++) {
            pointsLeft[i] = new Point((i + 1) * 2, (i + 1) * 2);
            pointsRight[i] = new Point(4 * (n + 1) - (i + 1) * 2, (i + 1) * 2);
            // pointsLeft[i] = new Point((i+1) * 0.5, (i+1) * ok);
            // pointsRight[i] = new Point(n + 1 - (i+1) * 0.5, (i+1) * ok);
        }

        long answer = 0;

        int lastSegmentThing = m;

        int rightStop = n - m;

        for (int leftPointId = m; leftPointId + m < n; leftPointId++) {

            int segmentLeft = -1, segmentRight = -1;

            int xx, yy, theirDx, theirDy;
            long theirAbs, yyyy3;

            {
                int rightPointId = leftPointId;
                xx = pointsLeft[leftPointId].x + pointsRight[rightPointId].x >> 1;
                yy = pointsLeft[leftPointId].y + pointsRight[rightPointId].y >> 1;
                theirDx = xx - pointsLeft[leftPointId].x;
                theirDy = yy - pointsLeft[leftPointId].y;
                theirAbs = (long) theirDx * theirDx + (long) theirDy * theirDy
                        * 3;

                yyyy3 = (long) yy * yy * 3;

                for (int low = lastSegmentThing; low + m < n; low++) {
                    long lowX = 4 * (low + 1);
                    long dx = xx - lowX;
                    long abs = dx * dx + yyyy3;
                    if (abs < theirAbs) {
                        segmentLeft = low;
                        break;
                    }
                }
            }

            // timeFirst += currentTimeMillis();
            int yyyy3i = (int) yyyy3;
            int theirAbsi = (int) theirAbs;
            if (segmentLeft < 0) {
                break;
            }
            lastSegmentThing = segmentLeft;

            segmentRight = n - 1 - segmentLeft;

            answer += segmentRight - segmentLeft + 1;

            int dx;

            int yyyy3MinusTheirAbsi = yyyy3i - theirAbsi;

            int curAddInt = 0;

            for (int rightPointId = leftPointId + 1; rightPointId < rightStop; rightPointId++) {
                --xx;
                ++yy;
                // xx = pointsLeft[leftPointId].x + pointsRight[rightPointId].x
                // >> 1;
                // yy = pointsLeft[leftPointId].y + pointsRight[rightPointId].y
                // >> 1;
                --theirDx;
                ++theirDy;
                // theirDx = xx - pointsLeft[leftPointId].x;
                // theirDy = yy - pointsLeft[leftPointId].y;
                yyyy3MinusTheirAbsi += 2 * theirDx + 1;
                yyyy3MinusTheirAbsi -= 6 * theirDy - 3;
                // theirAbs = theirDx * theirDx + theirDy * theirDy * 3;
                yyyy3MinusTheirAbsi += 6 * yy - 3;
                // if (yyyy3 > Integer.MAX_VALUE) {
                // System.err.println(yyyy3);
                // }
                // long yyyy3 = yy * yy * 3;
                // if (segmentLeft < lastLeftForThisRight[rightPointId]) {
                // segmentLeft = lastLeftForThisRight[rightPointId];
                // }
                // if(segmentRight > lastRightForThisRight[rightPointId]) {
                // segmentRight = lastRightForThisRight[rightPointId];
                // }
                int lowX = 4 * (segmentLeft + 1);
                dx = xx - lowX;
                int abs = dx * dx + yyyy3MinusTheirAbsi;
                while (segmentLeft <= segmentRight) {
                    // if (dx * dx > Integer.MAX_VALUE) {
                    // System.err.println(dx * dx);
                    // }
                    if (abs < 0) {
                        break;
                    } else {
                        ++segmentLeft;
                        abs -= 8 * dx - 16;
                        dx -= 4;
                    }
                }

                lowX = 4 * (segmentRight + 1);
                dx = (xx - lowX);
                abs = dx * dx + yyyy3MinusTheirAbsi;

                while (segmentLeft <= segmentRight) {
                    if (abs < 0) {
                        break;
                    } else {
                        --segmentRight;
                        abs += 8 * dx + 16;
                        dx += 4;
                    }
                }

                if (segmentLeft > segmentRight) {
                    rightStop = rightPointId;
                    break;
                }
                curAddInt += segmentRight - segmentLeft + 1;
            }
            answer += 2L * curAddInt;
        }

        // System.err.println("time first: "+timeFirst);
        // System.err.println("time second: "+timeSecond);
        return answer * 3L;
    }

    private static long solveWithoutOptimizations(int n, int m) {
        Point[] pointsLeft = new Point[n];
        Point[] pointsRight = new Point[n];
        for (int i = 0; i < n; i++) {
            pointsLeft[i] = new Point((i + 1) * 2, (i + 1) * 2);
            pointsRight[i] = new Point(4 * (n + 1) - (i + 1) * 2, (i + 1) * 2);
        }

        long answer = 0;

        int lastSegmentThing = m;

        for (int leftPointId = m; leftPointId + m < n; leftPointId++) {

            int segmentLeft = -1, segmentRight = -1;
            {
                int rightPointId = leftPointId;
                long xx = pointsLeft[leftPointId].x
                        + pointsRight[rightPointId].x >> 1;
                long yy = pointsLeft[leftPointId].y
                        + pointsRight[rightPointId].y >> 1;
                long theirDx = xx - pointsLeft[leftPointId].x;
                long theirDy = yy - pointsLeft[leftPointId].y;
                long theirAbs = theirDx * theirDx + (long) theirDy * theirDy
                        * 3;

                for (int low = lastSegmentThing; low + m < n; low++) {
                    long lowX = 4 * (low + 1);
                    long dx = xx - lowX;
                    long abs = dx * dx + yy * yy * 3;
                    if (abs < theirAbs) {
                        segmentLeft = low;
                        break;
                    }
                }
            }

            if (segmentLeft < 0) {
                break;
            }
            lastSegmentThing = segmentLeft;

            segmentRight = n - 1 - segmentLeft;

            answer += segmentRight - segmentLeft + 1;

            for (int rightPointId = leftPointId + 1; rightPointId < n - m; rightPointId++) {
                long xx = pointsLeft[leftPointId].x
                        + pointsRight[rightPointId].x >> 1;
                long yy = pointsLeft[leftPointId].y
                        + pointsRight[rightPointId].y >> 1;
                long theirDx = xx - pointsLeft[leftPointId].x;
                long theirDy = yy - pointsLeft[leftPointId].y;
                long theirAbs = theirDx * theirDx + theirDy * theirDy * 3;
                while (segmentLeft <= segmentRight) {
                    long lowX = 4 * (segmentLeft + 1);
                    long dx = xx - lowX;
                    long abs = dx * dx + yy * yy * 3;
                    if (abs < theirAbs) {
                        break;
                    } else {
                        ++segmentLeft;
                    }
                }

                while (segmentLeft <= segmentRight) {
                    long lowX = 4 * (segmentRight + 1);
                    long dx = xx - lowX;
                    long abs = dx * dx + yy * yy * 3;
                    if (abs < theirAbs) {
                        break;
                    } else {
                        --segmentRight;
                    }
                }

                if (segmentLeft > segmentRight) {
                    break;
                }
                answer += 2 * (segmentRight - segmentLeft + 1);
            }
        }

        return answer * 3L;
    }

    static long solveStupid(int n, int m) {
        Point[] pointsLeft = new Point[n];
        Point[] pointsRight = new Point[n];
        // double ok = Math.sqrt(3) * 0.5;
        for (int i = 0; i < n; i++) {
            pointsLeft[i] = new Point((i + 1) * 2, (i + 1) * 2);
            pointsRight[i] = new Point(4 * (n + 1) - (i + 1) * 2, (i + 1) * 2);
            // pointsLeft[i] = new Point((i+1) * 0.5, (i+1) * ok);
            // pointsRight[i] = new Point(n + 1 - (i+1) * 0.5, (i+1) * ok);
        }

        long answer = 0;

        for (int leftPointId = m; leftPointId + m < n; leftPointId++) {

            for (int rightPointId = m; rightPointId + m < n; rightPointId++) {
                long xx = pointsLeft[leftPointId].x
                        + pointsRight[rightPointId].x >> 1;
                long yy = pointsLeft[leftPointId].y
                        + pointsRight[rightPointId].y >> 1;

                long theirDx = xx - pointsLeft[leftPointId].x;
                long theirDy = yy - pointsLeft[leftPointId].y;
                long theirAbs = theirDx * theirDx + theirDy * theirDy * 3;

                for (int low = m; low + m < n; low++) {
                    long lowX = 4 * (low + 1);
                    long dx = xx - lowX;
                    long abs = dx * dx + yy * yy * 3;
                    if (abs < theirAbs) {
                        ++answer;
                    }
                }
            }
        }

        return answer * 3L;
    }

    static class Point {
        final int x, y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        InputStream input = System.in;
        PrintStream output = System.out;
        File file = new File("d.in");
        if (file.exists() && file.canRead()) {
            input = new FileInputStream(file);
        }
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(output);
        solve();
        out.close();
    }

    static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }
}


import java.io.FileReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long total = scanner.nextLong();
        long k = scanner.nextLong();

        long diplomas = total / (2 * (k + 1));
        long gramotas = diplomas * k;
        long s_nosom = total - (diplomas + gramotas);

        System.out.println(diplomas + " " + gramotas + " " + s_nosom);
    }

}


import java.util.Scanner;

public class Codeforces {
    public static void main(String[] args) {
        TaskA Solver = new TaskA();
        Solver.Solve();
    }
    private static class TaskA {
        private void Solve() {
            Scanner in = new Scanner(System.in);
            String S = in.nextLine();
            char s = S.charAt(0);
            char f = S.charAt(2);
            String direct1 = "v<^>v<^>";
            String direct2 = "v>^<v>^<";
            int n = in.nextInt();
            n %= 4;
            boolean fl1 = false, fl2 = false;
            if (F(n, s, f, direct1))
                fl1 = true;
            if (F(n, s, f, direct2))
                fl2 = true;
            if (fl1 && fl2)
                System.out.println("undefined");
            else {
                if (fl1)
                    System.out.println("cw");
                if (fl2)
                    System.out.println("ccw");
            }
        }
        private static boolean F(int n, char s, char f, String direct) {
            int i = direct.indexOf(s);
            return direct.charAt(i + n) == f;
        }
    }
}


	import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.TreeMap;

			public class Solution123 implements Runnable
			{
				static final int MAX = 1000000007;
				static class InputReader
				{
					private InputStream stream;
					private byte[] buf = new byte[1024];
					private int curChar;
					private int numChars;
					private SpaceCharFilter filter;
					private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

					public InputReader(InputStream stream)
					{
						this.stream = stream;
					}

					public int read()
					{
						if (numChars==-1)
							throw new InputMismatchException();

						if (curChar >= numChars)
						{
							curChar = 0;
							try
							{
								numChars = stream.read(buf);
							}
							catch (IOException e)
							{
								throw new InputMismatchException();
							}

							if(numChars <= 0)
								return -1;
						}
						return buf[curChar++];
					}

					public String nextLine()
					{
						String str = "";
			            try
			            {
			                str = br.readLine();
			            }
			            catch (IOException e)
			            {
			                e.printStackTrace();
			            }
			            return str;
					}
					public int nextInt()
					{
						int c = read();

						while(isSpaceChar(c))
							c = read();

						int sgn = 1;

						if (c == '-')
						{
							sgn = -1;
							c = read();
						}

						int res = 0;
						do
						{
							if(c<'0'||c>'9')
								throw new InputMismatchException();
							res *= 10;
							res += c - '0';
							c = read();
						}
						while (!isSpaceChar(c));

						return res * sgn;
					}

					public long nextLong()
					{
						int c = read();
						while (isSpaceChar(c))
							c = read();
						int sgn = 1;
						if (c == '-')
						{
							sgn = -1;
							c = read();
						}
						long res = 0;

						do
						{
							if (c < '0' || c > '9')
								throw new InputMismatchException();
							res *= 10;
							res += c - '0';
							c = read();
						}
						while (!isSpaceChar(c));
							return res * sgn;
					}

					public double nextDouble()
					{
						int c = read();
						while (isSpaceChar(c))
							c = read();
						int sgn = 1;
						if (c == '-')
						{
							sgn = -1;
							c = read();
						}
						double res = 0;
						while (!isSpaceChar(c) && c != '.')
						{
							if (c == 'e' || c == 'E')
								return res * Math.pow(10, nextInt());
							if (c < '0' || c > '9')
								throw new InputMismatchException();
							res *= 10;
							res += c - '0';
							c = read();
						}
						if (c == '.')
						{
							c = read();
							double m = 1;
							while (!isSpaceChar(c))
							{
								if (c == 'e' || c == 'E')
									return res * Math.pow(10, nextInt());
								if (c < '0' || c > '9')
									throw new InputMismatchException();
								m /= 10;
								res += (c - '0') * m;
								c = read();
							}
						}
						return res * sgn;
					}

					public String readString()
					{
						int c = read();
						while (isSpaceChar(c))
							c = read();
						StringBuilder res = new StringBuilder();
						do
						{
							res.appendCodePoint(c);
							c = read();
						}
						while (!isSpaceChar(c));

						return res.toString();
					}

					public boolean isSpaceChar(int c)
					{
						if (filter != null)
							return filter.isSpaceChar(c);
						return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
					}

					public String next()
					{
						return readString();
					}

					public interface SpaceCharFilter
					{
						public boolean isSpaceChar(int ch);
					}
				}

				public static void main(String args[]) throws Exception
				{
					new Thread(null, new Solution123(),"Solution123",1<<26).start();
				}
				static HashSet<Pair> hset = new HashSet();
				public void run()
				{
					InputReader sc= new InputReader(System.in);
					PrintWriter w= new PrintWriter(System.out);
					TreeMap<Integer,Integer> tmap = new TreeMap();
					int n = sc.nextInt();
					int[] arr=  new int[2*n];
					for(int i = 0;i < 2*n;i++){
						arr[i] = sc.nextInt();
					}
					Arrays.sort(arr);
					ArrayList<Integer> ar = new ArrayList();
					long ans = Integer.MAX_VALUE;
					for(int i = 0;i < 2*n;i++){
						for(int j = i+1;j < 2*n;j++){
							int k = 0;
							long temp = 0;
							int one = -1;
							int pow = 1;
							while(k < 2*n){
								if(k == i || k == j){
									k++;
									continue;
								}else{
									temp =  temp + (int)Math.pow(one,pow)*arr[k];
									pow++;
								}
								k++;
							}
							ans = Math.min(ans,temp);
						}
					}
					w.println(ans);
					w.close();
				}
				boolean isPalindrome(String s){
					for(int i = 0;i < s.length()/2;i++){
						if(s.charAt(i) == s.charAt(s.length()-1-i)){
							continue;
						}else{
							return false;
						}
					}
					return true;
				}
				long gcd(long a,long b)
				{
				    if (a == 0)
				        return b;
				    return gcd(b%a, a);
				}
				static class Pair{
					long x,y;
					Pair(long x,long y){
						this.x = x;
						this.y = y;
					}
					public boolean equals(Object o)
					{
						Pair p = (Pair)o;
						return p.x==x && p.y==y;

					}

					public int hashCode()
					{
						return new Long(x).hashCode()*31 + new Long(y).hashCode();
					}
				}
			}


import java.util.Scanner;

/**
 * Created by PQZR3864 on 2018-10-04.
 */
public class PhoneNumber {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 0;
        int n = input.nextInt();
        String digits = input.next();

        for(int i=0 ; i<digits.length() ;i++){
            if(digits.charAt(i) == '8') count++;
        }
        count = count > (n/11) ? (n/11) : count ;
        System.out.println(count);
        input.close();
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package RCC2014;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 *
 * @author tino chagua
 */
public class A {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] cad = br.readLine().split(" ");
        int c = Integer.valueOf(cad[0]);
        int d = Integer.valueOf(cad[1]);

        cad = br.readLine().split(" ");
        int n = Integer.valueOf(cad[0]);
        int m = Integer.valueOf(cad[1]);

        int k = Integer.valueOf(br.readLine());

        int min = n * m - k;

        if (min <= 0) {
            System.out.println(0);
            return;
        }

        int[] total = new int[min + 1];

        for (int y = 0; y < min + 1; y++) {
            int aux = min - y;
            int x = (aux / n);
            if (aux % n != 0) {
                x++;
            }
            total[y] = x * c + y * d;
        }
        Arrays.sort(total);
        System.out.println(total[0]);
    }
}


import java.util.Comparator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int x1 = in.nextInt();
        int x2 = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        int ia = a;

        if (canKill(x1, x2, a, b)) {
            out.println("FIRST");
            out.println(x2);
            return;
        }

        if (a <= 0 && b >= 0) {
            out.println("DRAW");
            return;
        }

        int delta = x2 - x1;
        if (b < 0) {
            delta = -delta;
            int temp = -b;
            b = -a;
            a = temp;
        }

        if (delta < 0) {
            out.println("DRAW");
            return;
        }
        if (delta % (a + b) == 0) {
            out.println("SECOND");
            return;
        }

        int mod = delta % (a + b);
        if (mod >= a && mod <= b) {
            out.println("FIRST");
            int sign = ia < 0 ? -1 : 1;
            out.println(x1 + sign * mod);
            return;
        }

        out.println("DRAW");
    }

    private boolean canKill(int x1, int x2, int a, int b) {
        int delta = x2 - x1;
        return delta >= a && delta <= b;
    }

}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}


import java.util.*;
import java.lang.*;
import java.io.*;

public class Code
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s= new Scanner(System.in);
		int n= s.nextInt();
	    int[] a= new int[n];
	    int count=1;int max=0;
	    for(int i=0;i<n;i++){
	        a[i]=s.nextInt();
	        if(i!=0){
	            if(a[i]==a[i-1]+1){
	                count++;
	                 if((i==1&&a[0]==1)||i==n-1&&a[n-1]==1000)
	                 count++;
	            }
	            else{
	                count=1;
	            }
	            if(max<count)
	            max=count;
	        }
	    }
	    if(max>=2)
	    System.out.println(max-2);
	    else
	    System.out.println(0);
	}
}


import java.util.Scanner;
public class A203 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int c=0;
        int x=sc.nextInt();
        int t=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        int da=sc.nextInt();
        int db=sc.nextInt();
        if(x!=0){
        for (int i = 0; i < t; i++) {
            if((a-i*da)==x ||(b-i*db)==x || (((a-i*da)+(b-i*db))==x )){
                System.out.println("YES");
                c++;
                break;
            }
        }
           if(c==0){
               for (int i = 0; i < t; i++) {
                   for (int j = 0; j < t; j++) {
                      if(((a-i*da)+(b-j*db))==x) {
                       System.out.println("YES");
                       c++;
                       break;
                   }
                   }
                   if(c!=0) break;
               }
           }
            if(c==0) System.out.println("NO");
        }
        else System.out.println("YES");

        }
    }


import java.util.Scanner;

public class Test {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    while (s.hasNextLine()) {
      s.nextLine();
      System.out.println(TextDocumentAnalysis.input(s.nextLine()));
    }
    s.close();
  }
  public static void main0(String[] args) {
    String[] ins = {
      "_Hello_Vasya(and_Petya)__bye_(and_OK)",
      "_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__",
      "(LoooonG)__shOrt__(LoooonG)",
      "(___)",
      "Q(___)_u(_U)HG"
    };
    for (int i=0; i<ins.length; i++) {
      String s = TextDocumentAnalysis.input(ins[i]);
      System.out.println(s);
    }
  }
}

class TextDocumentAnalysis {
  public static String input(String str) {
    int len = str.length();
    boolean open = false;
    int wc = 0;
    int max = 0;
    int wlen = 0;
    for (int i=0; i<len; i++) {
      char ch = str.charAt(i);
      if (ch == '(') {
        if (wlen > 0) {
          if (wlen > max) max = wlen;
          wlen = 0;
        }
        open = true;
      } else if (ch == ')') {
        if (wlen > 0) {
          wc++;
          wlen = 0;
        }
        open = false;
      } else if (ch == '_') {
        if (wlen > 0) {
          if (open) {
            wc++;
          } else {
            if (wlen > max) max = wlen;
          }
          wlen = 0;
        }
      } else {
        wlen++;
      }
    }
    if (wlen > 0) {
      if (open) {
        wc++;
      } else {
        if (wlen > max) max = wlen;
      }
    }
    return max + " " + wc;
  }
}


import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n;
		String s;
		n = sc.nextInt();
		s = sc.next();
		boolean openParathensis = false ;
		StringBuilder sb = new StringBuilder();
		int maxOutSide = 0;
		int nbrInside = 0;
		for(int i = 0 ; i<n;i++){
			if(s.charAt(i) == '('){
				if(!openParathensis){
					String[] outsideWords = sb.toString().split("_");
					for(String o : outsideWords){
						maxOutSide = Math.max(maxOutSide,o.length());
					}
				}
				openParathensis = true;
				sb = new StringBuilder();
			}
			else if(s.charAt(i) == ')'){
				openParathensis = false;
				List<String> inside = Arrays.asList(sb.toString().split("_"));
				nbrInside+=inside.stream().filter(x -> !x.isEmpty()).count();
				sb = new StringBuilder();
			}else{
				sb.append(s.charAt(i));
			}
		}
		String[] outsideWords = sb.toString().split("_");
		for(String o : outsideWords){
			maxOutSide = Math.max(maxOutSide,o.length());
		}
		System.out.println(maxOutSide+" "+nbrInside);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class main{
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));
		int cantidad = Integer.parseInt(entrada.readLine());
		int max = 0, palabras = 0, num1 = 0, num2 = 0;
		boolean dentro = false;
		String frase = entrada.readLine();
		char[] c = new char[cantidad];
		c = frase.toCharArray();
		for(int i=0;i<cantidad;i++){
			if(c[i]=='('){
				dentro = true;
				num1 = 0;
			}else if(c[i]==')'){
				dentro = false;
				if(num2>0){
					palabras++;
					num2 = 0;
				}
			}else{
				if(dentro){
					if(c[i]!='_'){
						num2++;
					}else{
						if(num2>0){
							palabras++;
							num2 = 0;
						}
					}
				}else{
					if(c[i]!='_'){
						num1++;
					}else{
						num1 = 0;
					}
				}
			}
			if(num1>=max){
				max = num1;
			}
		}
		System.out.println(max);
		System.out.println(palabras);
	}
}


import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solver s = new Solver();
        s.solve(in, out);
        out.close();
    }
    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int winpars = 0, longest = 0;
            int i = 0, j = 0;
            while (s.contains("__"))
                s = s.replaceAll("__", "_");
            n = s.length();
            if (s.charAt(i) == '(') {
                while (j < n && s.charAt(j++) != ')')
                if (s.charAt(j) == ')') {
                    String temp = s.substring(i + 1, j);
                    if (!temp.contains("_") && temp.length() > 0)
                        ++winpars;
                    else {
                        StringTokenizer tok = new StringTokenizer(temp, "_");
                        winpars += tok.countTokens();
                    }
                    i = j;
                }
            }
            while (i < n && s.charAt(i) != '(') {
                ++i;
                if (i < n && s.charAt(i) == '(') {
                    j = i;
                    while (j < n && s.charAt(j++) != ')')
                    if (s.charAt(j) == ')') {
                        String temp = s.substring(i + 1, j);
                        if (!temp.contains("_") && temp.length() > 0)
                            ++winpars;
                        else {
                            StringTokenizer tok = new StringTokenizer(temp, "_");
                            winpars += tok.countTokens();
                        }
                        i = j;
                    }
                }
            }
            while (s.indexOf('(') != -1 || s.indexOf(')') != -1)
                s = s.replaceAll("\\([^\\(]*\\)", "_");
            StringTokenizer tok = new StringTokenizer(s, "_");
            while (tok.hasMoreElements()) {
                String temp = tok.nextToken();
                if (temp.length() > longest)
                    longest = temp.length();
            }
            out.println(longest + " " + winpars);
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Stream;
import java.util.regex.Matcher;
import java.util.StringTokenizer;
import java.util.Optional;
import java.util.regex.Pattern;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String input = in.next();
            String pattern = "\\([\\w_]*\\)";
            String[] outSite = input.split(pattern);
            int longest = Arrays.stream(outSite).map(s -> longestWords(s)).max(Integer::compare).orElse(0);
            Pattern r = Pattern.compile(pattern);
            Matcher m = r.matcher(input);
            long numberInside = 0;
            while (m.find()) {
                numberInside += Arrays.stream(trimParentheses(m.group()).split("_")).filter(s -> !s.isEmpty()).count();
            }
            out.println(longest + " " + numberInside);
        }

        private int longestWords(String line) {
            return Arrays.stream(line.split("_")).map(String::length).max(Integer::compare).orElse(0);
        }

        private String trimParentheses(String input) {
            String temp = input.substring(1, input.length());
            return temp.substring(0, temp.length() - 1);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


//package MyPackage.YourPack.kfjf;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class splitITup {

    public  static  void main(String []args){
//37
//_Hello_Vasya(and_Petya)__bye_(and_OK)
        List<Integer> parentStart=new ArrayList<Integer>();
        List<Integer> parentEnd=new ArrayList<Integer>();

        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        String target=scan.next();
     for(int i=0;i<n;i++){
         if(target.charAt(i)=='(')
             parentStart.add(i);
         if(target.charAt(i)==')')
             parentEnd.add(i);

     }

     int count=0;
     for(int i=0;i<parentEnd.size();i++)
     {
         String s=target.substring(parentStart.get(i)+1,parentEnd.get(i));
        // System.out.print(s+" ");
         String ss[]=s.split("_");

       for(String f:ss)// System.out.print("#"+f+"#");

          if(!f.equals("")) count++;
     }

      //  System.out.println(count);
     int Max=0;
        parentEnd.add(0,0);
        parentStart.add(target.length());
       /* for (int i:parentStart)
          System.out.println(i);
        for (int i:parentEnd)
            System.out.println(i);

        */

        int i;
        if(target.charAt(0)=='(')
            i=1;
        else {

            i=0;
        }

     for(;i<parentEnd.size();i++){
         String s;
if(target.charAt(parentEnd.get(i))==')')
            s =target.substring(parentEnd.get(i)+1,parentStart.get(i));
else  s =target.substring(parentEnd.get(i),parentStart.get(i));
             String ss[]=s.split("_");
             for(String sss:ss){
                // System.out.println(sss);
                 if(sss.length()>Max&&!sss.contains("(")&&!sss.contains(")")){
                     Max=sss.length();
                 }
             }

     }
        System.out.println(Max+" "+count);

    }
}


import java.util.*;
import java.math.*;
import java.io.*;
 public class Main{

    static FastReader scan=new FastReader();
   public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
 static int mod(int x,int y)
    {
        if(x<0)
            x=x+(-x/y+1)*y;
        return x%y;
    }
    static int A=400,n;
    static int l[]=new int[5050];
    static int r[]=new int[5050];
    static char c[]=new char[5050];
static int solve(int x){
	int a=0,b=0;
	for(int i=0;i<n;i++)
	{
		if(x<l[i]||x>r[i])
			continue;
		if(c[i]=='M')
			a++;
		else b++;
	}
	return Math.min(a,b);
}
public static void main(String[] args)  throws IOException
{
 n=scan.nextInt();
String s=scan.next();
int cur=0,c=0,a=0,b=0;
for(int i=0;i<n;i++){
	if(s.charAt(i)=='('||s.charAt(i)==')'||s.charAt(i)=='_'){
		if(c>0){
			if(cur>0)b++;
			else a=Math.max(c,a);
			c=0;
		}
		if(s.charAt(i)=='(')
			cur=1;
		if(s.charAt(i)==')')cur=0;
	}
	else c++;
}
a=Math.max(a,c);
out.println(a+" "+b);
out.close();
}

 public static  long pow(long b, long e) {
            long r = 1;
            while (e > 0) {
                if (e % 2 == 1) r = r * b ;
                b = b * b;
                e >>= 1;
            }
            return r;
        }
private static void sort(long[] arr) {
        List<Long> list = new ArrayList<>();
        for (long object : arr) list.add(object);
        Collections.sort(list);
        for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
    }
 public static class FastReader {
        BufferedReader br;
        StringTokenizer root;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }

            return array;
        }
}
static class pair{
	int i;
	int j;
pair(int i,int j){
	this.i=i;
	this.j=j;
}

}}


/*
 * PDPM IIITDM Jabalpur
 * Asutosh Rana
 */

import java.util.*;
import java.io.*;
import java.math.*;

public class Main
{
    long MOD = 1000000007;
    InputReader in;BufferedReader br;PrintWriter out;
    public static void main (String[] args) throws java.lang.Exception
    {
        Main solver = new Main();
        solver.in = new InputReader(System.in);
        solver.br = new BufferedReader(new InputStreamReader(System.in));
        solver.out = new PrintWriter(System.out);
        solver.solve();
        solver.out.flush();
        solver.out.close();
    }

    public void solve(){
        int tc = 1;//in.readInt();

        for(int cas=1;cas<=tc;cas++){
            int N = in.readInt();
            String Str = in.readString();
            char[] S = Str.toCharArray();

            int count = 0, par =0;
            int wordInPar = 0, max_length = 0;
            for(int i=0;i<S.length;i++){
                if(S[i]=='_'){
                    if(par==0){
                        max_length = Math.max(max_length, count);
                    }
                    else if(count>0){
                        wordInPar++;
                    }
                    count=0;
                }
                else if(S[i]=='('){
                    par=1;
                    max_length = Math.max(max_length, count);
                    count=0;
                }
                else if(S[i]==')'){
                    par=0;
                    if(count>0){
                        wordInPar++;
                    }
                    count=0;
                }
                else{
                    count++;
                }
                if(par==0){
                    max_length = Math.max(max_length, count);
                }
            }

            out.println(max_length+" "+wordInPar);
        }

    }

}

class InputReader{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream){this.stream = stream;}
    public int read(){
        if (numChars==-1) throw new InputMismatchException();
        if (curChar >= numChars){
            curChar = 0;
            try {numChars = stream.read(buf);}
            catch (IOException e){throw new InputMismatchException();}
            if(numChars <= 0) return -1;
        }
        return buf[curChar++];
    }

    public int readInt(){
        int c = read();
        while(isSpaceChar(c)) c = read();
        int sgn = 1;
        if (c == '-') {sgn = -1;c = read();}
        int res = 0;
        do {
            if(c<'0'||c>'9') throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        while (!isSpaceChar(c)); return res * sgn;
    }

    public void readInt(int[] A){
        for(int i=0;i<A.length;i++)
            A[i] = readInt();
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        while (!isSpaceChar(c));
        return res * sgn;
    }

    public void readLong(long[] A){
        for(int i=0;i<A.length;i++)
            A[i] = readLong();
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public char[] readCharA(){
        return readString().toCharArray();
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }

}


import java.util.Scanner;

public class Main10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int am = scanner.nextInt();
        String zad = scanner.next();
        String s = zad;
        String skobki = "_";
        int str = -1;
        int len = s.length();

        for (int i = 0; i < len; i++) {
            char c = s.charAt(i);
            if (s.charAt(i) == '(') str = i;
            if (s.charAt(i) == ')') {
                skobki = skobki +"" + s.subSequence(str+1, i) + "_";
                s =  "" + s.subSequence(0, str) +"_"+ s.subSequence(i+1, s.length());
                len = s.length();
                i = str-1;
                str = -1;
            }
        }
        String arr [] = skobki.split("_");
        int count = 0;

        for (int i = 0; i < arr.length; i++)
            if (!arr[i].equals("")) count++;
         arr  = s.split("_");
        int max = 0;
        for (int i = 0; i < arr.length; i++)
            if (arr[i].length() > max) max = arr[i].length();
        System.out.println(max + " " + count);

    }
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String a = sc.next();
		boolean paren=false;
		int max = 0;
		int cnt = 0;
		int temp=0;

		for(int i = 0 ;i < n;i++){
		 if(a.charAt(i)=='_'){
		   if(paren==true&&temp!=0){
		   	 cnt++;
		     temp = 0;
		   }else{

		   	if(temp>max)
		   	max = temp;
		    temp = 0;
		   }

		 }else if(a.charAt(i)=='('){
		   paren = true;
		   	if(temp>max)
		   	max = temp;
		  	temp =0;
		 }else if(a.charAt(i)==')'){
		   paren = false;
		   if(temp>0){
		   	cnt++;
		   	temp = 0;
		   }

		 }else{
		    temp++;
		 }

		}
		if(temp>max)
		   	max = temp;

		System.out.println(max+" "+cnt);

	}
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeMap;

public class CF375B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.nextLine());
        String s1 = sc.next().toLowerCase();
        String s2 = s1;
        char ch[] = s1.toCharArray();
        StringBuilder sb = new StringBuilder(s2);
       Stack st = new Stack();

        for(int i = 0; i <ch.length;i++)
        {

        		st.push(sb.charAt(i));

        }
        List<Integer>list = new ArrayList<Integer>();

        for(int i = 0; i <ch.length;i++)
        {

        		if(ch[i]=='(')
        		{
        			st.pop();
        			list.add(i);
        		}
        		if(ch[i]==')')
        		{
        			st.pop();
        			list.add(i);
        		}

        }

        TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
        for(int i = 0; i<list.size();i = i+2)
        {
        	map.put(list.get(i), list.get(i+1));
        }
        List<Integer>list3 = new ArrayList<Integer>();
        for(Map.Entry<Integer, Integer>m:map.entrySet())
        {
        	int k = m.getKey();
        	int k1 = m.getValue();
        	for(int i = k; i<=k1;i++)
        	{
        		list3.add(i);
        	}
        }
        char c[] = new char[s1.length()-list3.size()];
        char c2[] = new char[list3.size()];
        int in = 0;
        int in2 = 0;
        for(int i = 0; i <ch.length;i++)
        {
        	if(!list3.contains(i))
        	{
        		c[in] = ch[i];
        		in++;

        	}

        }
        boolean b = true;
        for(int i = 0; i <ch.length;i++)
        {
        	if(list3.contains(i))
        	{
        	  if(ch[i]=='(' || ch[i]==')'||ch[i]=='_')
        	  {
        		  if(b==true)
        		  {
        		  c2[in2] = ' ';
        		  in2++;
        		  b=false;
        		  }
        	  }
        	  else
        		  {
        		  c2[in2] = ch[i];

        		in2++;
        		b=true;
        		  }
        	}
        }

        String pan = "";
        for(int i = 0; i <c2.length;i++)
        {

        	pan = pan+Character.toString(c2[i]);
        }

        String pa[] = pan.split(" ");
        List<Integer>list5 = new ArrayList<Integer>();
        for(int i = 0; i <pa.length;i++)
        {
        	String ba = pa[i].trim();
        	if(ba.length()!=0)
        	{
        	list5.add(pa[i].length());
        	}
        }

        String str = s1.replaceAll("\\(.*?\\) ?", " ");
        str = str.replace("_", " ");
        String string[] = str.split(" ");
        List<Integer>list8 = new ArrayList<Integer>();
        for(int i = 0; i <string.length;i++)
        {
        	String ba = string[i].trim();
        	if(ba.length()!=0)
        	{
        	list8.add(string[i].length());
        	}
        }
        Collections.sort(list8);
        if(list8.size()==0)
        {
          System.out.print(0);
        }

        else
        	{
        	System.out.print(list8.get(list8.size()-1));
        	}
        System.out.print(" "+list5.size());
        }

	}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class TextRed {
    public static void main(String[] args) {
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int len = Integer.parseInt(reader.readLine());
            String s = reader.readLine();
            reader.close();

            int verbCount = 0;

            int x = 0;
            ArrayList<Integer> list = new ArrayList<Integer>();
            boolean inScob = false;
            char[] array = s.toCharArray();
            list.add(0);
            for (char c : array) {
                if (c == '(') {
                    inScob = true;
                    if (x != 0) {
                        list.add(x);
                    }
                    x = 0;
                    continue;
                } else if (c == ')') {
                    inScob = false;
                    continue;
                }

                if (inScob == false && c != '_') {
                    x++;
                } else if (inScob == false && c == '_') {
                    list.add(x);
                    x = 0;
                }
            }
            if (x != 0)
            {
                list.add(x);
            }

            System.out.print(Collections.max(list) + " ");

            x = 0;
            inScob = false;
            for (char c:array)
            {
                if (c == '(') {
                  inScob = true;
                    x = 0;
                    continue;
                } else if (c == ')') {
                   inScob = false;
                    if (x != 0)
                    {
                        verbCount++;
                    }
                    x = 0;
                    continue;
                }

                if (inScob && c != '_' )
                {
                    x++;
                }else if (inScob && c == '_')
                {
                    if (x != 0)
                    {
                        verbCount++;
                    }
                    x = 0;
                }
            }

            System.out.print(verbCount);
        }catch (Exception e)
        {
            System.out.println(0 + " 0" + 0);
        }
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class TextDoc {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.nextLine();
		String s = scan.nextLine();
		String[] p = s.split("\\(.*?\\)");
		int max = 0;
		for(int i = 0; i < p.length; i++){
			StringTokenizer st = new StringTokenizer(p[i], "_");
			while(st.hasMoreTokens()){
				String b = st.nextToken();
				max = Math.max(b.length(), max);
			}
		}
		ArrayList<String> li = new ArrayList<String>();
		char a = '(';
		char b = ')';
		int last = -1;
		for(int i = 0; i < s.length(); i ++){
			char c = s.charAt(i);
			if(c == a){
				last = i;
			}
			if(c == b && last != -1){
				li.add(s.substring(last+1, i));
			}
		}
		int count = 0;
		for(int i = 0; i < li.size(); i++){
			String[] words = li.get(i).split("_");
			for(int j = 0; j < words.length; j++){
				if(words[j].length() > 0) count++;
			}
		}
		System.out.println(max+" "+count);
	}
}


//Rajkin Hossain.......
import java.io.*;
import java.util.*;
public class B{

    public static void main(String [] args)throws IOException{
        //FI k = new FI("E:/b.txt");
    	FI k = new FI(System.in);
    	//Scanner k = new Scanner(new File("E:/b.txt"));
    	PrintWriter z = new PrintWriter(System.out);
    	while(k.hasNext()){
    		int n = k.nextInt();
    		String s = k.next();
    		boolean ok = false;
    		int one = 0;
    		String tt = "";
    		String twoans = "";
    		boolean wordnok = true;
    		for(int c = 0;c<n;c++){
    			char ch = s.charAt(c);
    			if(ch == '('){
    				ok = true;
    				wordnok = true;
    				tt = "";
    			}
    			else if(ch == ')'){
    				tt = "";
    				ok = false;
    			}
    			else{
    				if(ok == false){

    					if(ch == '_'){
    						tt = "";
    					}
    					else{
    						tt += ch;
    					}

    					if(tt.length()>twoans.length()){
							twoans = tt;
						}
    				}
    				else{
    					if(ch == '_'){
    						wordnok = true;
    					}
    					else{
    						if(wordnok){
    							one++;
    							wordnok = false;
    						}
    					}
    				}
    			}

    		}
    		z.println(twoans.length()+" "+one);
    	}

       	z.flush();

    }

	public static class FI {
	    BufferedReader br;
	    StringTokenizer st;

	    public FI(InputStream stream){
	        br = new BufferedReader(new InputStreamReader(stream));
	    }

	    public FI(String s){
	        try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	    }

	    public String next() {
	        return nextToken();
	    }

	    public boolean hasNext(){
	    	try {
				return br.ready();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return false;
	    }

	    public String nextToken() {
	        while (st == null || !st.hasMoreTokens()) {
	            String line = null;
	            try {
	                line = br.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	            if (line == null) {
	                return null;
	            }
	            st = new StringTokenizer(line);
	        }
	        return st.nextToken();
	    }

	    public int nextInt() {
	        return Integer.parseInt(nextToken());
	    }

	    public long nextLong() {
	        return Long.valueOf(nextToken());
	    }

	}

    public static class FO extends PrintWriter {
        FO() { super(new BufferedOutputStream(System.out)); }
    }

}


import java.util.Scanner;

public class Text_Document_Analysis {

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		StringBuffer string=new StringBuffer(scanner.next());
		StringBuffer underScore=new StringBuffer();
		StringBuffer Bracket=new StringBuffer();
		int i=0,count=0,max=0,max2=0;
		while(i<n)
		{
			if(string.charAt(i)=='(')
			{
				i++;
				while(string.charAt(i)!=')')
				{
					Bracket.append(string.charAt(i));
					i++;
				}
				i++;
				Bracket.append("_");
				underScore.append("_");

			}
			else {
				underScore.append(string.charAt(i));
				i++;
			}
		}
		underScore.append("_");Bracket.append("_");
		//System.out.println(underScore+"*****"+Bracket);
		for(int j=0;j<underScore.length();j++)
		{
			if(underScore.charAt(j)=='_')
			{
				if(count>max) {
					max=count;
				}
				count=0;
			}
			else
				count++;
		}
		count=0;
		for(int j=0;j<Bracket.length();j++)
		{
			if(Bracket.charAt(j)=='_')
			{
				if(count>0) {
					max2++;
				}
				count=0;
			}
			else
				count++;
		}

		System.out.println(max+" "+max2);
	}

}


import java.util.Scanner;

public class cf2 {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		sc.nextLine();
		int count=0;
		int flag=0;
		int max=0;
		int len=0;
		String str=sc.nextLine();
		for(int i=0;i<t;i++)
		{
			flag=0;
			len=0;
			if(str.charAt(i)=='_')
				continue;
			else if(str.charAt(i)=='(')
			{
				i++;
				while(i<t && str.charAt(i)!=')')
				{
					if(i<t && str.charAt(i)!='_' && str.charAt(i)!=')')
					{
						while(i<t && str.charAt(i)!='_' && str.charAt(i)!=')')
							i++;
						count++;
						i--;
					}
					i++;
				}
			}
			else
			{
				if(i<t && str.charAt(i)!='_' && str.charAt(i)!='(' && str.charAt(i)!=')')
				{
					while(i<t && str.charAt(i)!='_' && str.charAt(i)!='(' && str.charAt(i)!=')')
					{
						len++;
						i++;
					}
					if(len>=max)
						max=len;
				}
				i--;
			}
		}
		System.out.println(max+" "+count);
	}

}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner st=new Scanner (System.in);
		int l=st.nextInt(); char ch; String wd="";
		int max=0,num=0;
		String s=st.next();
		int i,j=0;
		for(i=0;i<l;i++)
		{
			ch=s.charAt(i);
			if(ch=='(')
			{
			max=(max>wd.length())?max:wd.length();
				wd="";
				j=1;
			}
			else if(ch==')'){
				if(wd.length()!=0)
				num++;
			j=0;
			wd="";
			}
			else if(ch=='_')
			{
				if(j==1){
				if(wd.length()!=0)
				num++;}
				else
				max=(max>wd.length())?max:wd.length();
				wd="";
			}
			else{
			wd=wd+ch;
			if(i==l-1)
			max=(max>wd.length())?max:wd.length();
			}
			}
			System.out.println(max+" "+num);
		}

		// your code goes here
	}


// http://codeforces.com/problemset/problem/723/B

import java.util.Arrays;
import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner read = new Scanner(System.in);

		int n = read.nextInt();

		read.nextLine();

		String line = read.nextLine();

		StringBuilder lineWithoutParantheses = new StringBuilder();

		int numberOfWordsInParantheses = 0;
		int i = 0;
		while (i < line.length()) {
			if (line.charAt(i) == '(') {
				lineWithoutParantheses.append("_");
				i++;
				StringBuilder paranthesesWords = new StringBuilder();
				while (line.charAt(i) != ')') {
					paranthesesWords.append(line.charAt(i));
					i++;
				}

				String[] wordsInParantheses = paranthesesWords.toString().split("_");
				for (String word : wordsInParantheses) {
					if (!word.isEmpty()) {
						numberOfWordsInParantheses++;
					}
				}
			}
			else {
				lineWithoutParantheses.append(line.charAt(i));
			}
			i++;
		}

		int maxWordWithoutParanthesesLength = 0;
		String[] wordsWithoutParantheses = lineWithoutParantheses.toString().split("_");

		for (String word : wordsWithoutParantheses) {
			if (!word.isEmpty() && word.length() > maxWordWithoutParanthesesLength) {
				maxWordWithoutParanthesesLength = word.length();
			}
		}

		System.out.println(maxWordWithoutParanthesesLength + " " + numberOfWordsInParantheses);

		// Close scanner
		read.close();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.util.Optional;
import java.util.regex.Pattern;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String input = in.next();
            String pattern = "\\([\\w_]*\\)";
            String[] outSite = input.split(pattern);
            int longest = 0;
            for (String s : outSite) {
                longest = Math.max(longest, longestWords(s));
            }
            Pattern r = Pattern.compile(pattern);
            Matcher m = r.matcher(input);
            long numberInside = 0;
            while (m.find()) {
                numberInside += Arrays.stream(trimParentheses(m.group()).split("_")).filter(s -> !s.isEmpty()).count();
            }
            out.println(longest + " " + numberInside);
        }

        private int longestWords(String line) {
            return Arrays.stream(line.split("_")).map(String::length).max(Integer::compare).orElse(0);
        }

        private String trimParentheses(String input) {
            String temp = input.substring(1, input.length());
            return temp.substring(0, temp.length() - 1);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.Scanner;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CF_723B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();

		String regex = "\\([a-zA-Z_]*\\)";
		Pattern pat = Pattern.compile(regex);
		Matcher mat = pat.matcher(s);

		String newString = mat.replaceAll("_");

		String[] left = newString.split("_+");
		int maxLength = 0;
		for(int i = 0;i<left.length;i++){
			maxLength = Math.max(maxLength,left[i].length());
		}

		System.out.println(maxLength);
		int count = 0;
		boolean isStart = false;
		int startIndex = -1;
		int endIndex = -1;
		for(int i = 0;i<s.length();i++){
			char c = s.charAt(i);
			if(c == '('){
				isStart = true;
				startIndex = i;
				continue;
			}
			if(isStart){
				if(c == ')'){
					isStart = false;
					endIndex = i;
					String tmp = s.substring(startIndex+1,endIndex);
					if(tmp.equals(""))
						continue;
					if(tmp.startsWith("_")){
						String[] tmps = tmp.split("_+");
						if(tmps.length!=0)
							count+=(tmps.length-1);
						else
							count+=tmps.length;
					}else{
						String[] tmps = tmp.split("_+");
						count+=tmps.length;
					}

				}
			}
		}
		System.out.println(count);
	}
}


							import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;

											public class Solution1 implements Runnable
											{
												static final long MAX = 1000000007L;
												static class InputReader
												{
													private InputStream stream;
													private byte[] buf = new byte[1024];
													private int curChar;
													private int numChars;
													private SpaceCharFilter filter;
													private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

													public InputReader(InputStream stream)
													{
														this.stream = stream;
													}

													public int read()
													{
														if (numChars==-1)
															throw new InputMismatchException();

														if (curChar >= numChars)
														{
															curChar = 0;
															try
															{
																numChars = stream.read(buf);
															}
															catch (IOException e)
															{
																throw new InputMismatchException();
															}

															if(numChars <= 0)
																return -1;
														}
														return buf[curChar++];
													}

													public String nextLine()
													{
														String str = "";
											            try
											            {
											                str = br.readLine();
											            }
											            catch (IOException e)
											            {
											                e.printStackTrace();
											            }
											            return str;
													}
													public int nextInt()
													{
														int c = read();

														while(isSpaceChar(c))
															c = read();

														int sgn = 1;

														if (c == '-')
														{
															sgn = -1;
															c = read();
														}

														int res = 0;
														do
														{
															if(c<'0'||c>'9')
																throw new InputMismatchException();
															res *= 10;
															res += c - '0';
															c = read();
														}
														while (!isSpaceChar(c));

														return res * sgn;
													}

													public long nextLong()
													{
														int c = read();
														while (isSpaceChar(c))
															c = read();
														int sgn = 1;
														if (c == '-')
														{
															sgn = -1;
															c = read();
														}
														long res = 0;

														do
														{
															if (c < '0' || c > '9')
																throw new InputMismatchException();
															res *= 10;
															res += c - '0';
															c = read();
														}
														while (!isSpaceChar(c));
															return res * sgn;
													}

													public double nextDouble()
													{
														int c = read();
														while (isSpaceChar(c))
															c = read();
														int sgn = 1;
														if (c == '-')
														{
															sgn = -1;
															c = read();
														}
														double res = 0;
														while (!isSpaceChar(c) && c != '.')
														{
															if (c == 'e' || c == 'E')
																return res * Math.pow(10, nextInt());
															if (c < '0' || c > '9')
																throw new InputMismatchException();
															res *= 10;
															res += c - '0';
															c = read();
														}
														if (c == '.')
														{
															c = read();
															double m = 1;
															while (!isSpaceChar(c))
															{
																if (c == 'e' || c == 'E')
																	return res * Math.pow(10, nextInt());
																if (c < '0' || c > '9')
																	throw new InputMismatchException();
																m /= 10;
																res += (c - '0') * m;
																c = read();
															}
														}
														return res * sgn;
													}

													public String readString()
													{
														int c = read();
														while (isSpaceChar(c))
															c = read();
														StringBuilder res = new StringBuilder();
														do
														{
															res.appendCodePoint(c);
															c = read();
														}
														while (!isSpaceChar(c));

														return res.toString();
													}

													public boolean isSpaceChar(int c)
													{
														if (filter != null)
															return filter.isSpaceChar(c);
														return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
													}

													public String next()
													{
														return readString();
													}

													public interface SpaceCharFilter
													{
														public boolean isSpaceChar(int ch);
													}
												}

												public static void main(String args[]) throws Exception
												{
													new Thread(null, new Solution1(),"Solution",1<<26).start();
												}

												public static int gcd(int a, int b)
											    {
											        if (a == 0)
											            return b;

											        return gcd(b%a, a);
											    }
												int lcm(int a, int b)
												{
												    return (a*b)/gcd(a, b);
												}
												public void run()
												{
													InputReader sc= new InputReader(System.in);
													PrintWriter w= new PrintWriter(System.out);
													int n = sc.nextInt();
													String s = sc.next();
													int count1 = 0;
													int count2 = 0;
													char[] ch = s.toCharArray();
													boolean flag = false;
													ArrayList<Integer> ar=  new ArrayList();
													String st = "";
													for(int i = 0;i < s.length();i++) {
														if(Character.isLowerCase(ch[i]) || Character.isUpperCase(ch[i])) {
															st += ch[i];
														}else {
															if(st.length() == 0) {

															}
															else if(flag) {
																count1++;
															}else {
																ar.add(st.length());
															}
															st = "";
														}
														if(ch[i] == '(') {
															flag = true;
														} if(ch[i] == ')') {
															flag = false;
														}
													}
													if(st.length() != 0) {
														ar.add(st.length());
													}
													Collections.sort(ar);
													if(ar.size() == 0) {
														w.println(0 + " " + count1);
													}else
														w.println(ar.get(ar.size()-1) + " " + count1);
													w.close();
												}

												static class Pair implements Comparable<Pair>{
													long x;
													long y;
													long z;
													int ind;

													Pair(){}
													Pair(long x,long y,long z,int ind){
														this.x = x;
														this.y = y;
														this.z = z;
														this.ind = ind;
													}
													public int compareTo(Pair p){
														if(p.x == this.x) {
															return Long.compare(this.y,p.y);
														}
														return Long.compare(this.x,p.x);
													}
												}

								}


import java.util.Scanner;

public class Main {

	public static int Num;
	public static String Line;

	public static void main(String[] args) {

			Scanner buff = new Scanner(System.in); //new Scanner(new FileReader("/root/eclipse_workspace/java_workspace/codeforces/src/codeforces/C_723B.txt"));

			while(buff.hasNextLine()){
				String num = buff.nextLine();
				Num = Integer.parseInt(num);
				Line = buff.nextLine();
				char[] Text = Line.toCharArray();

				int i, maxVal = 0, wordCount = 0, wordLen = 0;
				for(i=0;i<Num;i++){

					if(Text[i]!='_'&& Text[i]!='('&&Text[i]!=')'){
						wordLen++;
					}
					else if(Text[i]=='_'){
						if(wordLen>maxVal){
							maxVal = wordLen;
						}
						wordLen = 0;
					}
					else if(Text[i]=='('){

						if(wordLen>maxVal){
							maxVal = wordLen;
						}
						wordLen = 0;

						i++;

						while(Text[i]!='\0'){

							if(Text[i]!='_'&& Text[i]!='('&&Text[i]!=')'){
								wordLen++;
								i++;
							}
							else if(Text[i]=='_'){
								if(wordLen!=0)
									{
										wordCount++;
										wordLen = 0;
									}
								i++;
								if(Text[i]==')')
									break;
							}
							else if(Text[i]==')')
							{
								if(wordLen!=0)
								{
									wordCount++;
									wordLen = 0;
								}
							//	i++;
								break;
							}

						}
					}

				}

				if(wordLen>maxVal){
					maxVal = wordLen;
				}
				wordLen = 0;

				System.out.println(maxVal + " " + wordCount);

			}

	}

}


//package com.turtle.bone;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class AK375 {
	public static Scanner cin = new Scanner(System.in);
	public String ak375(int n,String str){
		String[] arr=null;
		int i=0;
		int res1=0;
		int res2=0;
		StringBuffer tmpstr2 = new StringBuffer();
		StringBuffer tmpstr1 = new StringBuffer();

		for(i=0;i<n;i++){
			if(str.charAt(i)=='('){
				tmpstr2.append("_");
				while(str.charAt(i+1)!=')'){
//					System.out.println(str.charAt(i+1));
					tmpstr2.append(str.charAt(i+1));
					i++;
				}
			}else if(str.charAt(i)==')'){
				tmpstr1.append("_");
			}else{
				tmpstr1.append(str.charAt(i));
			}
		}
		String[] tmparrstr2=tmpstr2.toString().split("_");
		List arrstr2=new ArrayList();
		for(int k=0;k<tmparrstr2.length;k++){
			if(tmparrstr2[k]!=null && !tmparrstr2[k].equals("")){
				arrstr2.add(tmparrstr2[k]);
			}
		}
	//	System.out.println("tmpstr2:"+tmpstr2.toString());
		res2=arrstr2.size();
		String[] arrstr1=tmpstr1.toString().split("_");
	//	System.out.println("tmpstr1:"+tmpstr1.toString());
		for(int j=0;j<arrstr1.length;j++){
			if(arrstr1[j].length()>res1){
				res1=arrstr1[j].length();
			}
		}
		return res1+" "+res2;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		while (cin.hasNext()) {
			int n = cin.nextInt();
			String str = cin.next();
        long st=System.currentTimeMillis();
        String res=new AK375().ak375(n, str);
        long et=System.currentTimeMillis();
   //     System.out.println("time:"+(et-st));

        System.out.println(res);

		}
	}

}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();

		boolean insideBrackets = false;
		int countNoInside = 0, countMax = 0, wordSize = 0;

		for(int i=0;i<s.length();i++){

			char c = s.charAt(i);

			if(c!='(' && c!=')' && c!='_')
				wordSize++;
			if(c == '('){
				countMax = Math.max(countMax, wordSize);
				wordSize = 0;
				insideBrackets = true;
			}

			if(c == ')'){
				insideBrackets = false;
				if(wordSize>0){
					countNoInside++;
					wordSize = 0;
				}

			}
			if(c == '_'){
				if(insideBrackets && wordSize>0)
					countNoInside++;
				else if(c == '_' && !insideBrackets)
					countMax = Math.max(countMax, wordSize);
				wordSize = 0;
			}

		}
		countMax = Math.max(countMax, wordSize);
		System.out.println(countMax + " " + countNoInside);

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader r){	br = new BufferedReader(r);}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}

	}

}


import java.util.*;

/**
 * Created by naveen on 19-Dec-15.
 */
public class test {

    public static void main(String[] args) {

        Scanner scn = new Scanner(System.in);

        int n = Integer.parseInt(scn.nextLine());
        String ip = scn.nextLine();

        int wordCount = 0;
        int longestWord = 0;

        boolean insideBraces = false;

        StringBuilder stringBuilder = new StringBuilder("");

        for (int i = 0; i < n; i++) {
            char ch = ip.charAt(i);

            if(ch == '_') {
                int wordLength = stringBuilder.length();

                if(wordLength > 0) {
                    if(insideBraces) {
                        wordCount++;
                    }
                    else {
                        longestWord = Math.max(longestWord, wordLength);
                    }
                }

                stringBuilder = new StringBuilder("");
            }

            if(ch == '(') {
                int wordLength = stringBuilder.length();

                if(wordLength > 0) {
                    if(insideBraces) {
                        wordCount++;
                    }
                    else {
                        longestWord = Math.max(longestWord, wordLength);
                    }
                }

                stringBuilder = new StringBuilder("");
                insideBraces = true;
            }

            if(ch == ')') {
                int wordLength = stringBuilder.length();

                if(wordLength > 0) {
                    if(insideBraces) {
                        wordCount++;
                    }
                    else {
                        longestWord = Math.max(longestWord, wordLength);
                    }
                }

                stringBuilder = new StringBuilder("");
                insideBraces = false;
            }

            if((ch >= 'a' && ch <= 'z')
                || (ch >= 'A' && ch <= 'Z'))
                stringBuilder.append(ch);

        }

        int wordLength = stringBuilder.length();

        if(wordLength > 0) {
            if(insideBraces) {
                wordCount++;
            }
            else {
                longestWord = Math.max(longestWord, wordLength);
            }
        }

        System.out.println(longestWord + " " + wordCount);

    }

}


import java.util.Scanner;

public class Prepare {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int a;
		a = sc.nextInt();
		String in = sc.next();
		int len = 0;
		int tmp = 0;
		int count = 0;
		boolean bl = false;
		boolean prev = false;
		for(int i = 0; i < in.length(); i++){
			if( ((96 < in.charAt(i) - 0) && (in.charAt(i) < 123)) || (in.charAt(i) > 64 && in.charAt(i) < 91)){
			if(bl && !prev)
				count++;
			if(!bl)
			len++;
			if(len > tmp)
				tmp = len;
			prev = true;
			}

			else if(in.charAt(i) == '_'){
				prev = false;
				if(len > tmp)
				tmp = len;
				len = 0;
				}

			else if(in.charAt(i) == '('){
				prev = false;
				bl = true;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
			else if(in.charAt(i) == ')'){
				bl = false;
				prev = false;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
		}
		System.out.println(tmp+" "+count);
	sc.close();
	}

}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Oct 3, 2016 | 12:28:10 PM
 *

 * Description
 *
 *

 *
 * @author Essiennta Emmanuel (colourfulemmanuel@gmail.com)
 */
public class ProblemB {

    private void solve(char[] a, PrintWriter out) {
        int i = 0;
        int one = 0;
        int two = 0;
        boolean insideParenthesis = false;
        while (i != a.length) {
            if (a[i] == '(') {
                insideParenthesis = true;
            } else if (a[i] == ')') {
                insideParenthesis = false;
            } else if (Character.isLetter(a[i]))
                i--;
            if (insideParenthesis) { // inside
                while (++i != a.length && a[i] != ')' && !Character.isLetter(a[i]));
                if (i == a.length || !Character.isLetter(a[i])) {
                    continue;
                }
                while (Character.isLetter(a[++i]));
                two++;
            } else {
                while (++i != a.length && a[i] != '(' && !Character.isLetter(a[i]));
                if (i == a.length || !Character.isLetter(a[i])) {
                    continue;
                }

                int j = i;
                while (++i != a.length && Character.isLetter(a[i]));
                one = Math.max(one, i - j);
            }
        }
        out.println(one + " " + two);
    }

    public static void main(String[] args) throws IOException {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(args.length == 0 ? System.in : new FileInputStream(args[0])));
                PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            in.readLine();
            new ProblemB().solve(in.readLine().toCharArray(), out);
        }
    }
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String a = sc.next();
		boolean paren=false;
		int max = 0;
		int cnt = 0;
		int temp=0;

		for(int i = 0 ;i < n;i++){
		 if(a.charAt(i)=='_'){
		   if(paren==true&&temp!=0){
		   	 cnt++;
		     temp = 0;
		   }else{

		   	if(temp>max)
		   	max = temp;
		    temp = 0;
		   }

		 }else if(a.charAt(i)=='('){
		   paren = true;
		   	if(temp>max)
		   	max = temp;
		  	temp =0;
		 }else if(a.charAt(i)==')'){
		   paren = false;
		   if(temp>0){
		   	cnt++;
		   	temp = 0;
		   }

		 }else{
		    temp++;
		 }

		}
		if(temp>max)
		   	max = temp;

		System.out.println(max+" "+cnt);

	}
}


/**
 * Created by My PC on 03/10/2016.
 */

import java.util.*;

public class P2 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int length = input.nextInt();
        input.nextLine();
        String str = input.nextLine();

        int maxLength = 0;
        int countLength = 0;
        int countWord = 0;
        int checker = 0;
        int checkerInside = 0;
        boolean isInWordOut = false;
        boolean isInWordIn = false;
        boolean isInside = false;

        int index = 0;

        while (index < length)
        {
            if (str.charAt(index) == '(')
            {
                isInside = true;
                checkerInside++;
                if (maxLength < countLength)
                    maxLength = countLength;
                countLength = 0;
                isInWordOut = false;
            }
            else if (str.charAt(index) == ')')
            {
                isInside = false;
                checkerInside = 0;
                if (checker > 0)
                {
                    countWord++;
                    checker = 0;
                }
            }
            else
            {
                if (checkerInside > 0)
                {
                    isInside = true;
                }
            }

            if (index == length)
                break;

            if (str.charAt(index) != ')' & str.charAt(index) != '(')
            {
                if (!isInside)
                {
                    if (str.charAt(index) == '_')
                    {
                        if (maxLength < countLength)
                            maxLength = countLength;
                        countLength = 0;
                        isInWordOut = false;
                    }
                    else isInWordOut = true;

                    if (isInWordOut)
                    {
                        countLength++;
                    }
                }
                else
                {
                    isInWordOut = false;
                    if (str.charAt(index) == '_')
                    {
                        if (checker > 0)
                            countWord++;
                        checker = 0;
                        isInWordIn = false;
                    }
                    else isInWordIn = true;

                    if(isInWordIn)
                    {
                        checker++;
                    }
                }
            }

            index++;
        }

        if (maxLength < countLength)
            maxLength = countLength;

        System.out.println(maxLength + " " + countWord);

    }
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		String str;
		String len = sc.nextLine();
		String st = sc.nextLine();

		ArrayList<String> in = new ArrayList<>();
		int i =0;
		int cnt= 0;
		int j =0;
		int maxl = 0;
		while(i<st.lastIndexOf(')'))
		{

		    //if(st.indexOf('(',i)==j)
		    //j--;
		    String s = st.substring(j,st.indexOf('(',i));

		    StringTokenizer sto = new StringTokenizer(s,"_");
		    while(sto.hasMoreTokens()){
		        int l =sto.nextToken().length();
		        if(l>maxl)
		        maxl = l;
		    }
		    j = st.indexOf(')',j+1)+1;
		    String inside = st.substring(st.indexOf('(',i)+1,st.indexOf(')',i+1));

		    StringTokenizer sti = new StringTokenizer(inside,"_");
		    while(sti.hasMoreTokens()){
		        if(sti.nextToken()!="")
		        cnt++;
		    }
		    i = st.indexOf(')',i+1);

		}

		String s = st.substring(j);

	    StringTokenizer sto = new StringTokenizer(s,"_");
	    while(sto.hasMoreTokens()){
	        int l =sto.nextToken().length();
	        if(l>maxl)
	        maxl = l;
	    }
	    System.out.println(maxl+" "+cnt);
	}
}


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class B {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni();
		char[] s = ns().toCharArray();
		boolean inner = false;
		int len = 0;
		int max1 = 0;
		int num2 = 0;
		for(char c : s){
			if(c == '_'){
				if(inner){
					if(len > 0)num2++;
				}else{
					max1 = Math.max(max1, len);
				}
				len = 0;
			}else if(c == '('){
				if(inner){
					if(len > 0)num2++;
				}else{
					max1 = Math.max(max1, len);
				}
				inner = true;
				len = 0;
			}else if(c == ')'){
				if(inner){
					if(len > 0)num2++;
				}else{
					max1 = Math.max(max1, len);
				}
				inner = false;
				len = 0;
			}else{
				len++;
			}
		}
		if(inner){
			if(len > 0)num2++;
		}else{
			max1 = Math.max(max1, len);
		}
		out.println(max1 + " "  + num2);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new B().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


    import java.util.Scanner;

    public class JavaApplication1 {

    public static void main(String[] args)
    {

        Scanner sc=new Scanner(System.in);
        String s,ss="";int i,flag=0,max=0;
        s=sc.nextLine();
        s=sc.nextLine();
        s=s.replaceAll("_+", " ").trim();
        for(i=0;i<s.length();i++)
        {
            if(s.charAt(i) == '(')
                flag=1;
            else if(s.charAt(i) == ')')
            {
                ss+=" ";
                flag=0;
            }
            else if(flag == 1)
                ss+=s.charAt(i);
        }
        for(i=0;i<s.length();i++)
            if(s.charAt(i) == ')')
            {
                s=s.substring(0,s.indexOf("("))+" "+s.substring(i+1);
                i=0;
            }
            else if(s.charAt(i) == ')' && i == s.length()-1)
            {
                s=s.substring(0,s.indexOf("("));
                i=0;
            }
        s=s.replaceAll(" +", " ").trim();
        ss=ss.replaceAll(" +"," ").trim();
        String []out=s.split(" ");
        String []in=ss.split(" ");
        for(i=0;i<out.length;i++)
        {
            if(out[i].length() > max)
                max=out[i].length();
        }
        if(!ss.equals("") && !ss.equals(" "))
            System.out.println(max+" "+in.length);
        else
            System.out.println(max+" "+"0");
    }
}


import java.util.Scanner;

public class Words {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=sc.next();
		char[] ch=str.toCharArray();
		int[] temp=new int[n];
		int count=0;
		int k=0;
		for(int i=0;i<n;i++){
			temp[i]=0;
		}
		int flag = 0;
		if(ch[0]=='_'){
			flag=0;
		}
		else if(ch[0]=='('){
			flag=1;
		}
		for(int i=0;i<n;i++){
			if(flag==0){
				if(ch[i]=='_' ){
					k++;
				}
				else {
					if(ch[i]!='('){
						temp[k]++;
					}
					else if(ch[i]=='('){
						flag=1;

					}
					else if(ch[i]==')'){
						flag=0;
					}
				}
			}
			else{
				if(ch[i]==')'){
					flag=0;
					k++;
				}
				else if(i>0){
					 if(ch[i-1]=='('||ch[i-1]=='_'){
						 if( ch[i]!='_' && ch[i]!='('){
							 count++;
					 }

					}

				}

			}

		}

		int temp1;

		for(int i=0;i<n;i++){
			for(int j=i;j>0;j--){
				if(temp[j]>temp[j-1]){
					temp1=temp[j];
					temp[j]=temp[j-1];
					temp[j-1]=temp1;
				}
			}
		}
		System.out.println(temp[0]);
		System.out.println(count);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class codeforces {

    public static int Binary(int x,int array[]){
        int min=0;
        int max=array.length-1;
        int mid=0;
        while(min<max){
            mid=(max+min)/2;
            if (array[mid]==x)return mid;
            if (x>array[mid])min=mid+1;
            if (x<array[mid])max=mid-1;

        }

    return 0;}

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n=Reader.nextInt(),max=0,countw=0;
        String x=Reader.next();
        char ch[]=x.toCharArray();
        for (int i = 0; i < n; i++) {
            if(ch[i]!='_'&&ch[i]!='('){
            int count=0;
                for (int j = i; j < n; j++) {
                    if(ch[j]!='_'&&ch[j]!='(')count++;
                    if(ch[j]=='_'||ch[j]=='('||j==n-1){max=Math.max(max, count);i=j;count=0;break;}
                    }

            }
            if (ch[i]=='('){int count=0;
                for (int j = i; j < n; j++) {
                 if((ch[j]=='_'||ch[j]==')')&&count>0){countw++;count=0;}
                    if(ch[j]==')'){i=j;break;}
                     if(ch[j]!='_'&&ch[j]!='(')count++;

                }

            }

        }
        System.out.println(max+" "+countw);

    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Pb {

	public static void main(String[] args) throws NumberFormatException, IOException {

	Scanner s = new Scanner(System.in);
	BufferedReader br= new BufferedReader (new InputStreamReader(System.in));
	ArrayList<String > arr = new ArrayList<>();
	ArrayList<Integer > ar = new ArrayList<>();
	int tam = Integer.parseInt(br.readLine());
	String cad= br.readLine();
	String word ="";

	int cont = 0, mayor=0;
	boolean flg= false;

	for (int i = 0; i < tam; i++) {

		if(cad.charAt(i)=='('){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
			cont=0;
			flg=true;
			continue;
		}

		if(cad.charAt(i)==')' ){
			flg=false;
			if(word!=""){
				arr.add(word);
				word= "";
			}
			continue;

		}
		else if(flg==true && cad.charAt(i)!='_'){
			word+=cad.charAt(i);
			continue;

		}

		else if(flg== true && cad.charAt(i)=='_' && word!=""){
			arr.add(word);
			word="";
			continue;
		}

		else if(flg == false && cad.charAt(i)!='_'){
			cont++;
			if(i==(tam-1) && cont>= mayor){
				mayor=cont;
			}
			continue;

		}
		else if ( flg==false && cad.charAt(i)=='_'){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
			cont=0;
		}

	}
	//System.out.println(arr);

	System.out.println(mayor + " "+ arr.size());

	}

}