import java.util.Scanner;

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

/**
 *
 * @author Ismael
 */
public class Main{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Scanner in = new Scanner (System.in);
       int n= in.nextInt();
       int m= in.nextInt();
       int k=in.nextInt();
       int MOD= 1000000007;
       int C[][]= new int[2051][2051];
        for (int i= 0; i < 2051; i++) {
            C[0][i]=1;
            C[i][0]=1;
        }
        for (int i= 1; i < 2051; i++) {
            for (int j= 1; j < 2051; j++) {
                C[i][j]=(C[i-1][j]+C[i][j-1])%MOD;
            }
        }
       int res=0;
       if(!((n-1)<2*k||(m-1)<2*k)){
       res= (C[n-1-2*k][2*k]*C[m-1-2*k][2*k])%MOD;
        }
       System.out.println(res);
       /*
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                System.out.println("Combinaciones de "+(i+j)+" tomadas de a "+j+" son "+C[i][j]);
            }
        }
        */

    }

}


import java.util.Scanner;

public class E {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int[][]C = new int[1001][1001];
        C[1][0] = C[1][1] = 1;
        int p = (int) (1e9+7);
        for (int i = 2; i <= n; i++) {
            C[i][0] = 1;
            for (int j = 1; j <= 1000; j++) {
                C[i][j] = (C[i-1][j-1]+C[i-1][j]) % p;
            }
        }
        int ans = 0;
        if (2*k <= n-1)
            ans = C[n-1][2*k];
        if (2*k <= m-1)
            ans = (int)((long)ans*C[m-1][2*k] % p);
        else
            ans = 0;
        System.out.println(ans);
    }
}


import java.io.IOException;
import java.util.Scanner;

public class Prob128C
{
    public static void main( String[] Args ) throws IOException
    {
        Scanner in = new Scanner( System.in );
        int w = in.nextInt() - 2;
        int l = in.nextInt() - 2;
        int turns = in.nextInt();

        int h = w * ( w + 1 ) / 2;
        int v = l * ( l + 1 ) / 2;

        System.out.println( h * v / turns );
    }
}


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

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;

public class C {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    final int MOD = 1000000007;

    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int k = nextInt();

        if (Math.min(n, m) < 2 * k + 1) {
            out.print(0);
            return;
        }

        int[][] dp = new int[k + 1][Math.max(n, m) + 1];
        int[][] pref = new int[k + 1][Math.max(n, m) + 1];
        Arrays.fill(dp[0], 1);
        dp[0][0] = 0;
        for (int i = 1; i < dp[0].length; i++)
            pref[0][i] = pref[0][i - 1] + dp[0][i];
        for (int i = 1; i < dp.length; i++) {
            for (int j = 2 * i + 1; j < dp[i].length; j++) {
                dp[i][j] = dp[i][j - 1] + pref[i - 1][j - 2];
                pref[i][j] = pref[i][j - 1] + dp[i][j];
                if (pref[i][j] >= MOD)
                    pref[i][j] -= MOD;

            }
//          System.err.println(Arrays.toString(dp[i]));
//          System.err.println(Arrays.toString(pref[i]));
        }

        out.print((long) dp[k][n] * dp[k][m] % MOD);
    }

    void inp() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new C().inp();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    String nextString() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken("\n");
    }

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

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

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

}


import java.io.*;
import java.util.*;
import java.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays;

public class   cf514p2
{
  BufferedReader in;
  StringTokenizer as;
  boolean nums[][],nums2[][];
  ArrayList < Integer > [] ar;

  public static void main (String[] args)
  {
    new cf514p2  ();
  }

  public void solve(int a, int b)
  {
    try
    {
      for(int x = -1;x<=1;x++)
      {
        for(int y = -1;y<=1;y++)
        {
          if( ((x != 0) || (y!=0)) && !nums[a+x][b+y])
          {
            return;
          }
        }
      }
      for(int x = -1;x<=1;x++)
      {
        for(int y = -1;y<=1;y++)
        {
          if( ((x != 0) || (y!=0)))
          {
            nums2[a+x][b+y] = true;
          }
        }
      }
    }
    catch(Exception e )
    {

    }
  }

  public cf514p2  ()
  {
    try
    {

      in = new BufferedReader (new InputStreamReader (System.in));
      ArrayList < Integer > [] ar;
      int a = nextInt();
      int b = nextInt();
      nums = new boolean [a][b];
      nums2 = new boolean [a][b];
      for(int x = 0;x<a;x++)
      {
        String c = nextLine();
        for(int x1 = 0;x1<b;x1++)
        {
          if(c.charAt(x1) == '#')
          {
            nums[x][x1] = true;
          }
          else if (c.charAt(x) == '.')
          {
            nums[x][x1] = false;
          }
        }
      }
      for(int x = 1;x<a-1;x++)
      {
        for(int x1 = 1;x1<b-1;x1++)
        {
          solve(x,x1);
        }
      }
      for(int x = 0;x<a;x++)
      {
        for(int x1 = 0;x1<b;x1++)
        {
          if(nums2[x][x1] != nums[x][x1])
          {
            System.out.println("NO");
            System.exit(0);
          }
        }
      }
      System.out.println("YES");
    }

    catch(IOException e)
    {
      System.out.println("NO");
    }
  }

  String next () throws IOException
  {
    while (as == null || !as.hasMoreTokens ())
    {
      as = new StringTokenizer (in.readLine ().trim ());
    }

    return as.nextToken ();
  }

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

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

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

  String nextLine () throws IOException
  {
    return in.readLine ().trim ();
  }
}


import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int[] mn = Util.toIntArray(scanner.nextLine());

		int n = mn[0], m = mn[1];

		char[][] signArea = new char[n][m];

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

			signArea[i] = scanner.nextLine()
					.trim()
					.toCharArray();

		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {

				placePen(signArea, i, j);

			}
		}

		for (int i = 1; i < n - 1; i++) {
			for (int j = 1; j < m - 1; j++) {

				if(signArea[i][j] == '#') {
					System.out.println("NO");
					return;
				}

			}
		}
		System.out.println("YES");
	}

	private static void placePen(char[][] signArea, int i, int j) {

		if (isWithInk(i + 1,j + 1, signArea) &&
				isWithInk(i + 1,j, signArea)&&
				isWithInk(i + 1,j - 1, signArea) &&
				isWithInk(signArea, i, j + 1)  && isWithInk(signArea,i,j - 1)  && isWithInk(signArea, i - 1, j + 1)&&
				isWithInk(signArea, i - 1,j)&& isWithInk(i - 1,j - 1,signArea )) {
			signArea[i + 1][j + 1] = 'v';
			signArea[i + 1][j] = 'v';
			signArea[i + 1][j - 1] = 'v';
			signArea[i][j + 1] = 'v';
			signArea[i][j - 1] = 'v';
			signArea[i - 1][j + 1] = 'v';
			signArea[i - 1][j] = 'v';
			signArea[i - 1][j - 1] = 'v';
		}

	}

	public static boolean isWithInk(int i, int j, char[][] signArea) {
		return signArea[i][j] == 'v' || signArea[i][j] == '#';
	}

	public static boolean isWithInk(char[][] signArea, int i, int j) {
		return signArea[i][j] == 'v' || signArea[i][j] == '#';
	}
}


import java.util.*;
import java.util.regex.Pattern;
public class Forgery {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
in.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
String[] g = new String[n];
char[][] grid = new char[n][m];
for (int i=0; i<n; i++) {
    g[i] = in.next();
} // end for i

for (int i=0; i<n; i++) {
    for (int j=0; j<m; j++) {
        grid[i][j] = g[i].charAt(j);
    }
} // end for i

for (int i=1; i< n-1; i++) {
    for (int j=1; j<m-1; j++) {
        if ((grid[i-1][j-1] == '#' || grid[i-1][j-1] == 'x') &&
            (grid[i-1][j] == '#' || grid[i-1][j] == 'x') &&
            (grid[i-1][j+1] == '#' || grid[i-1][j+1] == 'x') &&
            (grid[i][j-1] == '#' || grid[i-1][j-1] == 'x') &&
            (grid[i][j+1] == '#' || grid[i-1][j+1] == 'x') &&
            (grid[i+1][j-1] == '#' || grid[i+1][j-1] == 'x') &&
            (grid[i+1][j] == '#' || grid[i+1][j] == 'x') &&
            (grid[i+1][j+1] == '#' || grid[i+1][j+1] == 'x') ) {
                grid[i-1][j-1] = 'x';
                grid[i-1][j] = 'x';
                grid[i-1][j+1] = 'x';
                grid[i][j-1] = 'x';
                grid[i][j+1] = 'x';
                grid[i+1][j-1] = 'x';
                grid[i+1][j] = 'x';
                grid[i+1][j+1] = 'x';
            } // end if

    }
} // end for i

boolean forge = true;
for (int i=0; i<n; i++) {
    for (int j=0; i<m; j++) {
        if (grid[i][j] = '#') forge = false;
    }
} // end for i

System.out.println(forge?"YES": "NO"); //
} // end main
}


import java.util.Scanner;
public class Dcoder{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a[]=new int[n];
		int b[]=new int[2];
		int l=0,w=0;
		int count1=0;
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			b[a[i]]++;
			if(a[i]==0){
			l=i;
			}
			if(a[i]==0 && count1==0){
				w=i;
				count1=1;
			}
		}
		int count=0;
		int q=0,z=0;
		for(int i=l;i<n;i++)
		{
			if(a[i]==1)
			count++;

		}
		for(int i=w;i<l;i++)
		{
			if(a[i]==1)
			q++;
		}
		for(int i=w;i<n;i++)
		{
			if(a[i]==0)
			z++;
			else
			q++;
			if(b[1]-q>b[0]-z+count){
				z=z+Math.max(b[1]-q,b[0]-z+count,0);
				break;

			}

		}
		System.out.print(Math.max(z,b[1],b[0]));

	}

}


// 作者：杨成瑞先生
import java.io.*;
import java.util.*;

public class template {

	static class FastScanner {

        static final int DEFAULT_BUFF = 1024, EOF = -1, INT_MIN = 48, INT_MAX = 57;
        static final byte NEG = 45;
        static final int[] ints = new int[58];

        static {
            int value = 0;
            for (int i = 48; i < 58; i++) {
                ints[i] = value++;
            }
        }

        InputStream stream;

        byte[] buff;
        int buffPtr;

        public FastScanner(InputStream stream) {
            this.stream = stream;
            this.buff = new byte[DEFAULT_BUFF];
            this.buffPtr = -1;
        }

        public int nextInt() throws IOException {
            int val = 0;
            int sign = readNonDigits();
            while (isDigit(buff[buffPtr]) && buff[buffPtr] != EOF) {
                val = (val << 3) + (val << 1) + ints[buff[buffPtr]];
                buffPtr++;
                if (buffPtr == buff.length) {
                    updateBuff();
                }
            }
            return val*sign;
        }

        private int readNonDigits() throws IOException {
            if (buffPtr == -1 || buffPtr == buff.length) {
                updateBuff();
            }
            if (buff[buffPtr] == EOF) {
                throw new IOException("End of stream reached");
            }
            int signByte = -1;
            while (!isDigit(buff[buffPtr])) {
                signByte = buff[buffPtr];
                buffPtr++;
                if (buffPtr >= buff.length) {
                    updateBuff();
                }
                if (buff[buffPtr] == EOF) {
                    throw new IOException("End of stream reached");
                }
            }
            if(signByte == NEG) return -1;
            return 1;
        }

        public void close() throws IOException {
            stream.close();
        }

        private boolean isDigit(int b) {
            return b >= INT_MIN && b <= INT_MAX;
        }

        private void updateBuff() throws IOException {
            buffPtr = 0;
            stream.read(buff);
        }
    }

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] games = new int[n];
        for(int i=0;i<n;i++) {
            games[i] = sc.nextInt();
        }
        int bad = 0;
        for(int i=1;i<n;i++) {
            if(games[i] == 0 && games[i-1] == 1) {
                bad++;
            }
        }
        System.out.println(games.length - bad);
	}

}


// 作者：杨成瑞先生
import java.io.*;
import java.util.*;

public class template {

	static class FastScanner {

        static final int DEFAULT_BUFF = 1024, EOF = -1, INT_MIN = 48, INT_MAX = 57;
        static final byte NEG = 45;
        static final int[] ints = new int[58];

        static {
            int value = 0;
            for (int i = 48; i < 58; i++) {
                ints[i] = value++;
            }
        }

        InputStream stream;

        byte[] buff;
        int buffPtr;

        public FastScanner(InputStream stream) {
            this.stream = stream;
            this.buff = new byte[DEFAULT_BUFF];
            this.buffPtr = -1;
        }

        public int nextInt() throws IOException {
            int val = 0;
            int sign = readNonDigits();
            while (isDigit(buff[buffPtr]) && buff[buffPtr] != EOF) {
                val = (val << 3) + (val << 1) + ints[buff[buffPtr]];
                buffPtr++;
                if (buffPtr == buff.length) {
                    updateBuff();
                }
            }
            return val*sign;
        }

        private int readNonDigits() throws IOException {
            if (buffPtr == -1 || buffPtr == buff.length) {
                updateBuff();
            }
            if (buff[buffPtr] == EOF) {
                throw new IOException("End of stream reached");
            }
            int signByte = -1;
            while (!isDigit(buff[buffPtr])) {
                signByte = buff[buffPtr];
                buffPtr++;
                if (buffPtr >= buff.length) {
                    updateBuff();
                }
                if (buff[buffPtr] == EOF) {
                    throw new IOException("End of stream reached");
                }
            }
            if(signByte == NEG) return -1;
            return 1;
        }

        public void close() throws IOException {
            stream.close();
        }

        private boolean isDigit(int b) {
            return b >= INT_MIN && b <= INT_MAX;
        }

        private void updateBuff() throws IOException {
            buffPtr = 0;
            stream.read(buff);
        }
    }

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] games = new int[n];
        for(int i=0;i<n;i++) {
            games[i] = Integer.parseInt(n);
        }
        int bad = 0;
        for(int i=1;i<n;i++) {
            if(games[i] == 0 && games[i-1] == 1) {
                bad++;
            }
        }
        System.out.println(games.length - bad);
	}

}

// 6
// 0 1 0 0 1 0


public class Solution {

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

		int n = in.nextInt();
		in.nextLine();

		int[] arr = new int[n]'
		for (int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}

		System.out.println(n);
		for (int i = 0; i < n; i++) {
			System.out.print(arr[i]);
		}
	}

}


import java.util.*;
public class MartianClock {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		String hour = new String();
		String minute = new String();
		int i = 0;
		while(str.charAt(i) == '0'){

			i++;
		}
		for(; str.charAt(i) != ':' ; i++){
			hour+=str.charAt(i);
		}
		i++;
		while(str.charAt(i) == '0'){
			i++;
		}
		for(;i < str.length() ; i++){
			minute+=str.charAt(i);
		}
		if(hour.length() == 1 && minute.length() == 1){
			if((hour.charAt(0) >= '0' && hour.charAt(0) <= '9') || (hour.charAt(0) >= 'A' && hour.charAt(0) <= 'N')){
				System.out.println(-1);
			}else{
				System.out.println(0);
			}
		}else{
			int max = 0;
			int arr[] = new int[36];
			for(int j = 0 ; j < 36 ; j++){
				arr[j] = j;
			}
			for(int j = str.length()-1 ; j >= 0 ; j--){
				if(str.charAt(j) == ':'){
					continue;
				}
				if(str.charAt(j) >= '0' && str.charAt(j) <= '9'){
					if(max < arr[Integer.parseInt(str.charAt(j)+"")]){
						max = arr[Integer.parseInt(str.charAt(j)+"")];
					}
				}else{
					int idx = str.charAt(j) - 65 + 10;
					if(max < arr[idx]){
						max = arr[idx];
					}
				}
			}
			max = max + 1;
//			System.out.println(max);
//			System.out.println(hour);
//			System.out.println(minute);
			int h_flag = 0;
			int m_flag = 0;
			int tmp = max;
			int prev_max = max;
			while(true){
				//System.out.println("max : "+max);
				int h_sum = 0;

				for(int j = hour.length() - 1 ; j >= 0 ; j--){
					int add = 0;
//					if(h_sum >= 24){
//						h_flag = 1;
//						break;
//					}
					if(hour.charAt(j) >= '0' && hour.charAt(j) <= '9'){
						add = Integer.parseInt(hour.charAt(j)+"");
					}else{
						add = hour.charAt(j) - 65 + 10;
					}
					if(h_sum + add*Math.pow(max, hour.length() - 1 - j) >= 24){
						h_flag = 1;
						break;
					}else{
						h_sum += add*Math.pow(max, hour.length() - 1 - j);
					}
				}
				//System.out.println("h_sum "+h_sum);
				int m_sum = 0;

				for(int j = minute.length() - 1 ; j >= 0 ; j--){
					int add = 0;
					if(minute.charAt(j) >= '0' && minute.charAt(j) <= '9'){
						add = Integer.parseInt(minute.charAt(j)+"");
					}else{
						add = minute.charAt(j) - 65 + 10;
					}
					if(m_sum + add*Math.pow(max, minute.length() - 1 - j) >= 60){
						m_flag = 1;
						break;
					}else{
						m_sum += add*Math.pow(max, minute.length() - 1 - j);
					}
				}
				//System.out.println("m_sum "+m_sum);
				//
				if(h_flag == 0 && m_flag == 0){
					System.out.print(max+" ");
					max++;

				}else{
					if(prev_max == max){
						System.out.println(0);
					}
					break;
				}
			}
		}
	}
}


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

public class B {
    public static StreamTokenizer in = new StreamTokenizer(System.in);
    public static boolean bg = true;

    public static void main(String[] args) throws Exception {
        in = null;
        Scanner scan = new Scanner(System.in);
        String[] l1 = scan.next().split(":");
        char[] ll1 = l1[0].toCharArray();
        char[] ll2 = l1[1].toCharArray();

        int[] v1 = new int[ll1.length];
        int[] v2 = new int[ll2.length];
        for (int i=0;i<ll1.length;i++){
            v1[i] = qq(ll1[i]);
        }
        for (int i=0;i<ll2.length;i++){
            v2[i] = qq(ll2[i]);
        }

        if (check(v1,v2)){
            pn(-1);
            ex();
        }

        HashSet<Integer> s1 = new HashSet();
        for (int i=1;;i++){
            if (ok(v1,i) ){
                int cur = parse(v1, i);
                if (cur<=23){
                    s1.add(i);
                }
                else {
                    break;
                }
            }
        }

        HashSet<Integer> s2 = new HashSet();
        for (int i=1;;i++){
            if (ok(v2,i) ){
                int cur = parse(v2, i);
                if (cur<=59){
                    s2.add(i);
                }
                else {
                    break;
                }
            }
        }

        //pn(s1);
        //pn(s2);

        s1.retainAll(s2);

        ArrayList<Integer> fin = new ArrayList();
        fin.addAll(s1);
        Collections.sort(fin);

        if (fin.size()==0){
            pn(0);
            ex();
        }

        for (int e: fin){
            p(e+" ");
        }
        pn("");

    }
    public static boolean check(int[] l1, int[] l2){
        ArrayList<Integer> f1 = new ArrayList();
        ArrayList<Integer> f2 = new ArrayList();
        for (int i=0;i<l1.length-1;i++){
            if (l1[i]!=0) return false;
        }
        for (int i=0;i<l2.length-1;i++){
            if (l2[i]!=0) return false;
        }
        if (l1[l1.length-1]<=23
                &&l2[l2.length-1]<=59
                ){
            return true;
        }
        return false;
    }
    public static int parse(int[] l1, int rdx){
        int fin = 0;
        for (int e: l1){
            fin *= rdx;
            fin += e;
        }
        return fin;
    }
    public static boolean ok(int[] l1, int rdx){
        for (int e: l1){
            if (rdx <=e) return false;
        }
        return true;
    }
    public static int qq(char c1){
        if (c1 - '0'>=0
                &&c1 - '0'<=9
                ){
            return c1 - '0';
        }
        else return c1 - 'A' + 10;
    }
    private static int ni() throws Exception {
        in.nextToken();
        return (int) in.nval;
    }

    private static long nl() throws Exception {
        in.nextToken();
        return (long) in.nval;
    }

    private static double nd() throws Exception {
        in.nextToken();
        return in.nval;
    }

    private static void pn(Object o1) {
        System.out.println(o1);
    }

    private static void p(Object o1) {
        System.out.print(o1);
    }

    private static void ex() {
        System.exit(0);
    }
}


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

public class B {
    public static StreamTokenizer in = new StreamTokenizer(System.in);
    public static boolean bg = true;

    public static void main(String[] args) throws Exception {
        in = null;
        Scanner scan = new Scanner(System.in);
        String[] l1 = scan.next().split(":");
        char[] ll1 = l1[0].toCharArray();
        char[] ll2 = l1[1].toCharArray();

        int[] v1 = new int[ll1.length];
        int[] v2 = new int[ll2.length];
        for (int i=0;i<ll1.length;i++){
            v1[i] = qq(ll1[i]);
        }
        for (int i=0;i<ll2.length;i++){
            v2[i] = qq(ll2[i]);
        }

        if (check(v1,v2)){
            pn(-1);
            ex();
        }

        HashSet<Integer> s1 = new HashSet();
        for (int i=1;;i++){
            if (ok(v1,i) ){
                int cur = parse(v1, i);
                if (cur<=23){
                    s1.add(i);
                }
                else {
                    break;
                }
            }
        }

        HashSet<Integer> s2 = new HashSet();
        for (int i=1;;i++){
            if (ok(v2,i) ){
                int cur = parse(v2, i);
                if (cur<=59){
                    s2.add(i);
                }
                else {
                    break;
                }
            }
        }

        //pn(s1);
        //pn(s2);

        s1.retainAll(s2);

        ArrayList<Integer> fin = new ArrayList();
        fin.addAll(s1);
        Collections.sort(fin);

        if (fin.size()==0){
            pn(0);
            ex();
        }

        for (int e: fin){
            p(e+" ");
        }
        pn("");

    }
    public static boolean check(int[] l1, int[] l2){
        ArrayList<Integer> f1 = new ArrayList();
        ArrayList<Integer> f2 = new ArrayList();
        for (int i=0;i<l1.length;i++){
            if (l1[i]!=0) f1.add(i);
        }
        for (int i=0;i<l2.length;i++){
            if (l2[i]!=0) f2.add(i);
        }
        if (f1.size()==1) if (f1.get(0)== l1.length-1){
            if (f2.size()==1) if (f2.get(0)== l2.length-1){
                if (l1[l1.length-1]<=23) if (l2[l2.length-1]<=59) return true;
            }
        }
        return false;
    }
    public static int parse(int[] l1, int rdx){
        int fin = 0;
        for (int e: l1){
            fin *= rdx;
            fin += e;
        }
        return fin;
    }
    public static boolean ok(int[] l1, int rdx){
        for (int e: l1){
            if (rdx <=e) return false;
        }
        return true;
    }
    public static int qq(char c1){
        if (c1 - '0'>=0
                &&c1 - '0'<=9
                ){
            return c1 - '0';
        }
        else return c1 - 'A' + 10;
    }
    private static int ni() throws Exception {
        in.nextToken();
        return (int) in.nval;
    }

    private static long nl() throws Exception {
        in.nextToken();
        return (long) in.nval;
    }

    private static double nd() throws Exception {
        in.nextToken();
        return in.nval;
    }

    private static void pn(Object o1) {
        System.out.println(o1);
    }

    private static void p(Object o1) {
        System.out.print(o1);
    }

    private static void ex() {
        System.exit(0);
    }
}


import java.io.*;
public class mar
{
    void arrange(String a,int p[],int g[],int m)
{
    int y=0;
for(int x=m-1;x>=0;x--)
{
char c=a.charAt(x);
if(c>=65 && c<=90)
{
p[y]=c-55;
g[y]=c-55;
y++;
}
else
{
p[y]=c-48;
g[y]=c-48;
y++;
}
}}
    int mart(int p[],int k,int m)
{
int w=1,sum=0,x;
for(x=0;x<m;x++)
{
sum=sum+p[x]*w;
w=w*k;
}
return sum;
}

void sort(int g[],int m)
{
for(int x=0;x<m;x++)
{
for(int y=x+1;y<m;y++)
{
if(g[x]<g[y])
{
int t=g[x];
g[x]=g[y];
g[y]=t;
}}}
}

public static void main(String args[])throws IOException
    {
        int x,max,y,z,k,y1,min,w,t=1,sum;
        BufferedReader xyz=new BufferedReader(new InputStreamReader(System.in));
        String s=xyz.readLine();
        for(x=0;s.charAt(x)!=':';x++);

        String a=s.substring(0,x);
        String b=s.substring(x+1);
        int m=a.length();
        int n=b.length();
        int p[]=new int[m];
        int g[]=new int[m];
        int q[]=new int[n];
        int h[]=new int[n];
        mar obj=new mar();
        obj.arrange(a,p,g,m);
        obj.arrange(b,q,h,n);
        obj.sort(g,m);
        obj.sort(h,n);
        if(g[0]>h[0])
        max=g[0];
        else
        max=h[0];
        k=max+1;
        int u=obj.mart(p,k,m);
        int v=obj.mart(q,k,n);
        if(g[0]>23|| u>23 ||v>59)
        System.out.println(0);
        else if(m==1 && n==1)
         System.out.println(-1);
        else if(m==1)
        {
           for(y1=k;t==1;y1++)
         {
             sum=0;w=1;
             for(z=0;z<n;z++)
             {
                 sum=sum+q[z]*w;
                 w=w*y1;
             }

             if(sum>59)
                 break;
         }
            for(x=k;x<y1;x++)
                System.out.print(x+" ");
        }
        else if(n==1)
        {
            for(y=k;t==1;y++)
         {   sum=0;
             w=1;
             for(z=0;z<m;z++)
             {
                 sum=sum+p[z]*w;
                 w=w*y;
             }
            if(sum>23)
                break;
         }
            for(x=k;x<y;x++)
                System.out.print(x+" ");
        }
        else if((g[1]==0 && h[1]==0 && p[0]!=0 && q[0]!=0) || (g[0] && h[0]==0))
        System.out.println(-1);
        else
        {
            y=-2;y1=-2;
         if((g[1]!=0 || p[0]==0) && g[0]!=0 )
         {
         for(y=k;t==1;y++)
         {   sum=0;
             w=1;
             for(z=0;z<m;z++)
             {
                 sum=sum+p[z]*w;
                 w=w*y;
             }

            if(sum>23)
                break;
         }}

          if((h[1]!=0 || q[0]==0) && h[0]!=0 )
          {
         for(y1=k;t==1;y1++)
         {
             sum=0;w=1;
             for(z=0;z<n;z++)
             {
                 sum=sum+q[z]*w;
                 w=w*y1;
             }

             if(sum>59)
                 break;
         }}
          if(y==-2)
              min=y1;
          else if(y1==-2)
               min =y;
           else if(y<y1)
                min=y;
            else
                min=y1;
            for(x=k;x<min;x++)
                System.out.print(x+" ");

        }
}
}


package demo;

import java.util.Scanner;

public class DemoTranslation {
	public static int n, k, x;
	Scanner scan = new Scanner(System.in);
	public static int[] a = new int[1_000];

	public static void main(String[] args) {
		n = scan.nextInt();
		k = scan.nextInt();
		x = scan.nextInt();
		int sum = 0;
		for(int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
			sum += a[i];
		}
		sum -= a[n - 1];
		sum += x;
		k--;
		int num = 1;
		while(k != 0) {
			if(a[n - 1 - num] <= x) {
				break;
			}
			sum -= a[n - 1 - num];
			sum += x;
			num++;
			k--;
		}
		System.out.println(sum);
	}

}


import java.util.*;
public class chores{
    public static void main(String[]args){
        Scanner s = new Scanner(System.in);
        int y = s.nextInt();
        int z = s.nextInt();
        int x = s.nextInt();
        int [] chores = new int[y];
        int t = 0;
        for (int i = 0; i < y; i++){
            chores[i] = s.nextInt();
            if (i+z >= y && chores[i] > x)chores [i] = x;
            time+= chores[i];
        }
        System.out.println(t);
    }
}


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

public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	 Scanner sc=new Scanner(System.in);
        int n=sc.nextInt() , k = sc.nextInt(), x = sc.nextInt();
        int s ;
        for(int i=0 ; i<n-k;i++)
        {
            s += sc.nextInt();
        }
        System.out.print(s+(k*x));
	}
}


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

public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        //Scanner sc = new Scanner();
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();

    }

    static long INF = (long)1e10;
    static int maxn = (int)1e6+5;
    static int mod= 1000000321 ;
    static int n,m,k,t,q,d,p,min=0;

    void solve(PrintWriter out, Reader in) throws IOException{
        n = in.nextInt();
        k = in.nextInt();
        int x = in.nextInt();

        int[] arr = new int[n];
        for(int i=0;i<n;i++) arr[i] in.nextInt();
        int ans = 0;
        for(int i=n-1;i>=n-k;i--) {
            ans += Math.min(arr[i],x);
        }
        for(int i=n-k-1;i>=0;i--) {
            ans += arr[i];
        }

        out.println(ans);
    }

    //<>

    static class Reader {

    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public Reader() {
        this(System.in);
    }

    public Reader(InputStream is) {
        mIs = is;
    }

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

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

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

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

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

    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 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 boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    }
}


 //package Practice;

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

import Practice.CodeforcesC.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner in=new Scanner(System.in);
		StringBuilder sb=new StringBuilder();
		int n=in.nextInt();
		String s=in.nextLine();
		int cnt=0;
		for(int i=0;i<n;i++){
			int x=0;int y=0;
			for(int j=i;j<n;j++){
				if(s.charAt(j)=='U'){
					x++;
				}else{
					if(s.charAt(j)=='D'){
						x--;
					}
					else{
						if(s.charAt(j)=='L'){
							y--;
						}
						else
							y++;

					}
				}
				if(x==0&&y==0)
					cnt++;
			}
		}
		System.out.println(cnt);

	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

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

		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
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

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

	}

}


import java.util.Scanner;

/**
 * Created by Chihwa on 2/13/2016.
 */
public class A8VC {

//    public int getSubAndCheck(String s) {
//        if (s.length() <= 1) {
//            return 0;
//        }
//
//        int length = s.length(), c, i;
//        String sub;
//
//        int r = 0;
//        for (c = 0; c < length; c++) {
//            for (i = 1; i <= length - c; i++) {
//                sub = s.substring(c, c + i);
//                int lr = 0;
//                int ud = 0;
//                for (int j = 0; j < sub.length(); j++) {
//                    if (sub.charAt(j) == 'L') {
//                        lr++;
//                    } else if (sub.charAt(j) == 'R') {
//                        lr--;
//                    } else if (sub.charAt(j) == 'U') {
//                        ud++;
//                    } else if (sub.charAt(j) == 'D') {
//                        ud--;
//                    }
//                }
//
//                if (lr == 0 && ud == 0) {
//                    r++;
//                }
//
//            }
//        }
//        return r;
//
//    }

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

        int r = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                String sub = st.substring(i, j);

                int lr = 0;
                int ud = 0;
                for (int j = 0; j < sub.length(); j++) {
                    if (sub.charAt(j) == 'L') {
                        lr++;
                    } else if (sub.charAt(j) == 'R') {
                        lr--;
                    } else if (sub.charAt(j) == 'U') {
                        ud++;
                    } else if (sub.charAt(j) == 'D') {
                        ud--;
                    }
                }

                if (lr == 0 && ud == 0) {
                    r++;
                }
            }
        }

        System.out.println(r);
    }
}


 //package Practice;

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

import Practice.CodeforcesC.Scanner;

public class CodeforcesA {

	public static void main(String[] args) throws IOException {
		Scanner in=new Scanner(System.in);
		StringBuilder sb=new StringBuilder();
		int n=in.nextInt();
		String s=in.nextLine();
		int cnt=0;
		for(int i=0;i<n;i++){
			int x=0;int y=0;
			for(int j=i;j<n;j++){
				if(s.charAt(j)=='U'){
					x++;
				}else{
					if(s.charAt(j)=='D'){
						x--;
					}
					else{
						if(s.charAt(j)=='L'){
							y--;
						}
						else
							y++;

					}
				}
				if(x==0&&y==0)
					cnt++;
			}
		}
		System.out.println(cnt);

	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

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

		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
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

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

	}

}


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

public class VCVentureCup {

	static class Point {

		int x, y;

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

		public String toString(){
			return String.format("%d %d", x,y);
		}
	}

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

		TreeSet<sub> set = new TreeSet<>();

		int n = sc.nextInt();
		String s = sc.nextLine();

		int c = 0;
		for(int i = 0;i < n - 1;++i){
			Point p = new Point(0,0);
			if (s.charAt(i) == 'U')
				p.x += 1;
			else if (s.charAt(i) == 'D')
				p.x -= 1;
			else if (s.charAt(i) == 'L')
				p.y -= 1;
			else
				p.y += 1;

			for(int j = i + 1;j < n;++j){

				if (s.charAt(j) == 'U')
					p.x += 1;
				else if (s.charAt(j) == 'D')
					p.x -= 1;
				else if (s.charAt(j) == 'L')
					p.y -= 1;
				else
					p.y += 1;

				if (p.x == 0 && p.y == 0){
					//set.add(new sub(i, j));
					c++;
				}
			}
		}

		//pw.println(set.size());
		pw.println(c);
		pw.close();
	}

	static class MyScanner {
		StringTokenizer st;
		BufferedReader br;

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

		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 {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

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

	}
}


public class CDF_762_B {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int testCases = scanner.nextInt();
        for(int i=0;i<testCases;i++){
            System.out.println(isPolycarp(scanner.nextInt()));
        }
    }

    private static int isPolycarp(int n) {

        HashSet<Integer> set = new HashSet<>();

        for(int i=1; i*i<=n;i++){
            set.add(i*i);
        }
        for(int i=1; i*i*i<=n;i++){
            set.add(i*i*i);
        }
        return set.size();
    }
}


import java.util.*;
public class Solution{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int res = (int)Math.sqrt(n)+(int)Math.cubrt(n)-(int)Math.sqrt((int)Math.cubrt(n));
            System.out.println(res);
        }
    }
}


import java .util.*;

public class SQUARESANDCUBES {
	public static void main(String [] args)
	{
		Scanner in= new Scanner(System.in);
		int n=in.nextInt();
		//in.nextLine();
		long ar[]=new long[20];
		int i,j;
		double f;
		double s,c,h;
		for(i=0;i<n;i++)
		{
			ar[i]=in.nextInt();
		}
		for(i=0;i<n;i++)
		{
			s=Math.floor(Math.sqrt(ar[i]));
			c=Math.floor(Math.cbrt(ar[i]));
			h=Math.floor(Math.sqrt(Math.cbrt(ar[i])));
			f=s+c-h;
			System.out.printf("%.0f\n",f);
		}

	}


import java.util.*;
import java.lang.*;
import java.io.*;
 public class Solution{
public class Main {
    public static  int getCount(int n){
        int count=0;
        for(int i=1;i<=Math.ceil(Math.cbrt(n));i++){
            int x = i*i*i;
            if(Math.floor(Math.sqrt(x))==Math.ceil(Math.sqrt(x))){
                if(Math.floor(Math.cbrt(x))==Math.ceil(Math.cbrt(x))){
                    count++;
                    //cout<<i<<" ";
                }

            }
        }
        return count;
    }
    public static void main (String[] args) throws java.lang.Exception {
        int t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            System.out.println((int)Math.sqrt(n)+(int)Math.cbrt(n)-getCount(n));

        }
    }
    // Fast Reader Class
    public static FastReader sc = new FastReader();
    public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
        public FastReader() { br = new BufferedReader(new InputStreamReader(System.in));}
        String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } }return st.nextToken(); }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); }return str; }
    }
}
//    int n = sc.nextInt(), p = sc.nextInt(), k = sc.nextInt();
//            if(p%k<=(n-1)%k){
//                    n--;
//                    long ans = (p%k)*((n+k)/k)-((p%k-1)*(p%k))/(2*k);
//                    System.out.println(ans);
//                    ans+=(p-(p%k))/k+1;
//                    System.out.println(ans);
//                    }else{
//                    long ans=0;
//                    n--;
//                    ans+=(n%k)*(n+k)/k;
//                    ans+=(p%k-n%k-1)*(((n+k)/k)-1);
//                    ans+=(p-(p%k))/k+1;
//                    System.out.println(ans);
//                    }


import java.util.* ;
public class contes
{
   public static void main(String ar[])
   {
      Scanner sc =  new Scanner(System.in) ;
      int n = sc.nextInt() ;
      int m = sc.nextInt() ;
      int max = 0 ;
      int sum = 0 ;
      for(int i = 0 ; i <n ; i++)
         {
            int k = sc.nextInt() ;
            max = Math.max(max, k) ;
            sum += k ;
         }
      int ans2 = m + k ;
      int ans1 = Math.max(ans2, (sum + m - 1) / n) ;
      System.out.println(ans1+" "+ans2) ;
   }
}


import java.util.*;
public class Solution
{

    static int findMin(int arr[] , int m)
    {
        for(int i = 0 ; i < arr.length - 1 ; i ++)
        {
            m = m - (arr[arr.length - 1] - arr[i]);
            if(m <= 0)
            return arr[arr.length - 1];
        }

        if(m % arr.length == 0)
        return (m/arr.length + arr[arr.length - 1];

        return (m/arr.length + 1 + arr[arr.length - 1]);
    }
    public static void main(String []args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int arr[] = new int[n];

        for(int i = 0 ; i < n ; i++)
        {
          arr[i] = sc.nextInt();
        }

        Arrays.sort(arr);
        int max = arr[arr.length - 1] + m;

        int min = findMin(arr , m);
        System.out.print(min);
        System.out.print(" ");
        System.out.print(max);
    }
}


import java.util.*;
import java.util.ArrayList;
public class Main{

   static class Pair
   {
      int x;
      String y;

      Pair(int x, String y){
         this.x=x;
         this.y=y;
      }

   }

    public static void main(String[] args){

        Scanner param=new Scanner(System.in);
          double n=param.nextInt();
         int k=param.nextInt();
         int arr[]=new int[n];
         int sum=0;
         int max=Integer.MIN_VALUE;
         for(int i=0;i<n;i++){
             arr[i]=param.nextInt();
             sum+=arr[i];
             max=Math.max(max,arr[i]);

         }
         int min=0;
         min=(int)Math.ceil((sum+k)/n);
         max+=k;
         System.out.println(min+" "+max);

}
}


import java.util.*;
public class Problem4 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n,sum=0,m,sum2;
        n=input.nextInt();
        m=input.nextInt();
        int[] arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=input.nextInt();
            sum+=arr[i];
        }
        Arrays.sort(arr);
       /* for(int i=0;i<n;i++){
            System.out.println(arr[i]);
        }*/
       sum2=(sum+m)/n;
       int l=(sum+m)%n;
       if(l!=0){
           sum1++;
       }
        System.out.println(sum2+" "+(m+arr[n-1]));
    }
}


public class Code {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
          Scanner s=new Scanner(System.in);
       int n=s.nextInt();
       int m=s.nextInt();
   int x[]=new int[n];
   int y[]=new int[m];
    for(int i=0;i<n;i++){
        x[i]=100;
        }
        for(int i=0;i<m;i++){
        y[i]=10;
        }

       int co=0,co1=0;
       while(true)
       {
          int c=0,h=0,f=0,f1=0;
          while(c<220){
          while(c<200 && co<n){
          c+=100;co++;
          }
          while(c<220 && co1<m){
          c+=10;co1++;}
          if(c==220){
              f=1;
              break;}
            else
                break;
             }
          if(f!=1)
          {
          System.out.println("Hanako");
          System.exit(0);
          }
           while(h<220){
          while(h<220 && co1<m){
          h+=10;co1++;
          }
          while(h<=120 && co<n){
          h+=100;co++;}
         if(h==220){
              f1=1;
              break;}
         else
             break;
            }
          if(f1!=1)
          {
          System.out.println("Ciel");
          System.exit(0);
          }

          }

       }

        // TODO code application logic here

    /*
        for(int i=0;i<n;i++){
        x[i]=s.nextInt();
        }
      int c=0,k=0,min=x[0];
        for(int j=0;j<n;j++)
        {
            if(x[j]<min){
                min=x[j];
                   k=j;  }

        }
        for(int i=0;i<n;i++)
        {
            if(x[i]==min)
                c++;
            if(c==2){
            System.out.println("Still Rozdil");
            System.exit(0);
            }
        }
        System.out.println(k+1);
        */

    }


import java.util.*;
public class A {
    static class Parser {
        final private int BUFFER_SIZE = 1 << 16;

        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Parser(InputStream in) {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public char nextChar() throws Exception {
            byte c = read();
            while (c <= ' ')
                c = read();
            return (char) c;
        }

        public int nextLong() throws Exception {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = c == '-';
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws Exception {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws Exception {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
    }
    public static void main(String[] args) throws Exception {
        Parser aa=new Parser(System.in);
        int x=aa.nextLong();
        int y=aa.nextLong();
        int val;
        int t=0;
        while(true) {
            //System.out.println(x+" "+y);
            if(t==0) {
                val=x*100+y*10;
                if(val<220){
                    System.out.println("Hanako"); return;
                }
                int mx=Math.min(x,2);
                x-=mx;
                int rem=220-mx*100;
                int my=rem/10;
                if(my>y){
                    System.out.println("Hanako"); return;
                }
                y-=my;
                t=1;
            }
            else {
                val=x*100+y*10;
                if(val<220){
                    System.out.println("Ciel"); return;
                }
                int my;
                if(y>=12) {
                    my=12;
                }else if(y>=2) {
                    my=2;
                }
                else {
                    System.out.println("Ciel"); return;
                }
                y-=my;
                int rem=220-my*10;
                int mx=rem/100;
                x-=mx;
                t=0;
            }
        }
    }
}


public class Code {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
          Scanner s=new Scanner(System.in);
       int n=s.nextInt();
       int m=s.nextInt();

       while(true){
           int f=0,f1=0;
           if(n*100+m*10<220 ||m<2){
               System.out.println("Hanako");
               System.exit(0);}
           else if (n>=2)
            {
             n-=2;m-=2; }
         else if(n>0){
           n-=1;m-=12;
           }
           else
         {m-=22;}
           if(n*100+m*10<220 ||m<2){
               System.out.println("Ceil");
               System.exit(0);}
           else if(m>=22)
           {m-=22;}
           else if(m>=12 && m<22)
           {m-=12;n-=1;}
           else {
           n-=2;m-=2;}

       }

    }
}


public class Code {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
          Scanner s=new Scanner(System.in);
       int n=s.nextInt();
       int m=s.nextInt();
   int x[]=new int[n];
   int y[]=new int[m];
    for(int i=0;i<n;i++){
        x[i]=100;
        }
        for(int i=0;i<m;i++){
        y[i]=10;
        }

       int co=0,co1=0;
       while(true)
       {
          int c=0,h=0,f=0,f1=0;
          while(c<220){
          while(c<200 && co<n){
          c+=100;co++;
          }
          while(c<220 && co1<m){
          c+=10;co1++;}
          if(c==220){
              f=1;
              break;}
            else
                break;
             }
          if(f!=1)
          {
          System.out.println("Hanako");
          System.exit(0);
          }
           while(h<220){
          while(h<220 && co1<m){
          h+=10;co1++;
          }
          while(h<=120 && co<n){
          h+=100;co++;}
         if(h==220){
              f1=1;
              break;}
         else
             break;
            }
          if(f1!=1)
          {
          System.out.println("Ciel");
          System.exit(0);
          }

          }

        // TODO code application logic here

    /*
        for(int i=0;i<n;i++){
        x[i]=s.nextInt();
        }
      int c=0,k=0,min=x[0];
        for(int j=0;j<n;j++)
        {
            if(x[j]<min){
                min=x[j];
                   k=j;  }

        }
        for(int i=0;i<n;i++)
        {
            if(x[i]==min)
                c++;
            if(c==2){
            System.out.println("Still Rozdil");
            System.exit(0);
            }
        }
        System.out.println(k+1);
        */

       }

    }


import java.math.BigInteger;
import java.util.scanner;
public class ehsan
{
	public static void main(String[] args)
  	{
		Scanner sc = new Scanner(System.in);
		BigInteger bi1 = sc.nextBigInteger();
		BigInteger bi2 = sc.nextBigInteger();
		BigInteger i=BigInteger.valueOf(1);
		BigInteger sum=BigInteger.valueOf(1);
		for(i=BigInteger.valueOf(1);i.lessThan(bi2);i=i.add(BigInteger.valueOf(1))){
			sum=sum.add(i);
			if(sum.equals(bi1)){
				System.out.println(i);
				break;
			}
			else if(bi1.lessThan(sum)){
				System.out.println(i.add(BigInteger.valueOf(-1)));
				break;
			}
		}
		if(sum.lessThan(bi))
			System.out.println(-1);
	}
}


import java.util.*;

public class Pipeline {

    public static long sumOfPipes(long n, long k) {

        long left = 1;
        long right = k;

        while (left < right) {
            long mid = (left + right) / 2;
            long s = sum(mid, k);
            if (s == n) {
                return k - mid + 1;
            } else if (s > n) {
                left = mid + 1;
            } else {
                right = mid;
            }
        }

        return k - left + 2;
    }

    static long sum(long left, long right) {
        long s = 0;
        if (left <= right) {
            s = sum(right) - sum(left - 1);
        }
        return s;
    }

    static long sum(long k) {
        return k * (k + 1) / 2;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long k = in.nextLong();
        if (n == 1) {
            System.out.println(0);
        } else if (k >= n) {
            System.out.println(1);
        } else {
            n -= 1;
            k -= 1;

            if (sum(k) < n) {
                System.out.println(-1);
            } else {

                System.out.println(sumOfPipes(n, k));

            }
        }
    }
}
Pipeline.txt
Displaying Pipeline.txt.


import java.math.BigInteger;
public class B
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        BigInteger bi1 = sc.nextBigInteger();
        BigInteger bi2 = sc.nextBigInteger();
        BigInteger i=1;
        BigInteger sum=1;
        for(i=1;i<bi2;i=i.add(BigInteger.valueOf(1))){
            sum+=i;
            if(sum==bi1){
                System.out.println(i);
                break;
            }
            else if(sum>bi1){
                System.out.println(i.add(BigInteger.valueOf(-1)));
                break;
            }
        }
        if(sum<bi)
            System.out.println(-1);
    }
}


import java.util.Scanner;
public class Fen {
public static Scanner in = new Scanner(System.in);
private static long N,L,Q,E,K,s=2;
    public static void main(String[] args) {
        N=in.nextLong();L=in.nextLong();Q=L;E=L/2;
        if(Q%2==0){K=((Q+1)*(E-1))+2;}
        else{K=(Q+1)*(E);K++;}
        if(L==N||L==N-1){System.out.println(N-L+1);}
        else if(K>N+1){E=2;Bol(E,L);System.out.println(L+1-E);}
        else if (K==N||K==N+1){System.out.println(L-1);}
        else {System.out.println(-1);}}
    private static void Bol(long Star , long End)
    {long mid = (Star+End)/2;E=Star;
    if(K/N>=1&&K-N<Star){if(K-N==Star)E++;}
    else {if(K>N){if(Star+End%2!=0&&Star+1==End){mid++;}E=mid;}
    else {E=(Star+s)/2;}
            if((Q-E+1)%2!=0){K=((Q+E-2)*((Q+1-E)/2))+((Q+E)/2);if((Q+E)%2!=0)K++;}
            else{K=((Q+E-2)*((Q+1-E)/2));K++;}if(K>N){s=E;}Bol(E,Q);}


import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            switch(s.charAt(i)){
            case '>': res+= "1000";
                break;
            case '<': res+= "1001";
                break;
            case '+': res+= "1010";
                break;
            case '-': res+= "1011";
                break;
            case '.': res+= "1100";
                break;
            case ',': res+= "1101";
                break;
            case '[': res+= "1110";
                break;
            case ']': res+= "1111";
                break;

            }
        }
        int sum = 0;
        for (int i = 0; i < res.length(); i++) {
            sum = sum *2 + res.charAt(i)-'0';
            sum %= 1000003;
        }
        System.out.println(sum);

    }


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

//codeforce
public class codeforcet{

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        //--------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

//codeforce
public class codeforcet{

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        //-------------------------------------------------------------------------
        //Initializing...
        new codeforcet();
        //-------------------------------------------------------------------------
        //put your code here... :)
        String n=nextString();
        String y="";
        for (int i = 0; i < n.length(); i++) {
            if(n.charAt(i)=='+'){
                y=y+"1010";
            }else if(n.charAt(i)=='-'){
                y=y+"1011";
            }else if(n.charAt(i)=='<'){
                y=y+"1001";
            }else if(n.charAt(i)=='>'){
                y=y+"1000";
            }else if(n.charAt(i)==']'){
                y=y+"1111";
            }else if(n.charAt(i)=='['){
                y=y+"1110";
            }else if(n.charAt(i)==','){
                y=y+"1101";
            }else if(n.charAt(i)=='.'){
                y=y+"1100";
            }
        }
        int d=0;
//      for (int i = 0; i < y.length(); i++) {
//          int t=((int)y.charAt(i))-48;
//          if(t==1){
//              d+=Math.pow(2, y.length()-i-1);
//          }
//      }
        BigInteger res = new BigInteger(y,2);
        BigInteger m=new BigInteger("1000003");
        System.out.println(res.mod(m));
//      int y1=Integer.parseInt(y,2);
//
//      System.out.println(y1%1000003);
        //writeln("");
        //-------------------------------------------------------------------------
        //closing up
        end();
        //--------------------------------------------------------------------------

    }
    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return input.nextToken();
    }
    public codeforcet() throws IOException {
        //Input Output for Console to be used for trying the test samples of the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //-------------------------------------------------------------------------
        //Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }

    private static void end() throws IOException{
        in.close();
        out.close();
        System.exit(0);
    }

}
-----------------------------------------
        //Initializing...
        new codeforcet();
        //-------------------------------------------------------------------------
        //put your code here... :)
        String n=nextString();
        String y="";
        for (int i = 0; i < n.length(); i++) {
            if(n.charAt(i)=='+'){
                y=y+"1010";
            }else if(n.charAt(i)=='-'){
                y=y+"1011";
            }else if(n.charAt(i)=='<'){
                y=y+"1001";
            }else if(n.charAt(i)=='>'){
                y=y+"1000";
            }else if(n.charAt(i)==']'){
                y=y+"1111";
            }else if(n.charAt(i)=='['){
                y=y+"1110";
            }else if(n.charAt(i)==','){
                y=y+"1101";
            }else if(n.charAt(i)=='.'){
                y=y+"1100";
            }
        }
        int d=0;
//      for (int i = 0; i < y.length(); i++) {
//          int t=((int)y.charAt(i))-48;
//          if(t==1){
//              d+=Math.pow(2, y.length()-i-1);
//          }
//      }
        BigInteger res = new BigInteger(y,2);
          System.out.println(res);
//      int y1=Integer.parseInt(y,2);
//
//      System.out.println(y1%1000003);
        //writeln("");
        //-------------------------------------------------------------------------
        //closing up
        end();
        //--------------------------------------------------------------------------

    }
    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())
            input = new StringTokenizer(in.readLine());
        return input.nextToken();
    }
    public codeforcet() throws IOException {
        //Input Output for Console to be used for trying the test samples of the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //-------------------------------------------------------------------------
        //Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }

    private static void end() throws IOException{
        in.close();
        out.close();
        System.exit(0);
    }

}


import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
public class Unary
{
    static int func(char ch)
    {
        switch(ch)
            {
                case '>': return 8;
                case '<': return 9;
                case '+': return 10;
                case '-': return 11;
                case '.': return 12;
                case ',': return 13;
                case '[': return 14;
                case ']': return 15;
                default: return 0;
            }
    }
    public static void main(String args[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.nextLine();
        int i,size = 0;
        for(i = 0;i < s.length(); ++i)
        {
            size = size * 16 + func(s.charAt(i)) % 1000003;
        }
        PrintWriter pr = new PrintWriter(System.out);
        pr.println(size);
        pr.close();
    }
}


import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
public class Unary
{
    static int func(char ch)
    {
        switch(ch)
            {
                case '>': return 8;
                case '<': return 9;
                case '+': return 10;
                case '-': return 11;
                case '.': return 12;
                case ',': return 13;
                case '[': return 14;
                case ']': return 15;
                default: return 0;
            }
    }
    public static void main(String args[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.ReadLine();
        int i,size = 0;
        for(i = 0;i < s.length(); ++i)
        {
            size = size * 16 + func(s.charAt(i)) % 1000003;
        }
        PrintWriter pr = new PrintWriter(System.out);
        pr.println(size);
        pr.close();
    }
}


import java.util.*;public class Main { static Scanner reader = new Scanner(System.in);static void main(String[] args) {
        int f = reader.nextInt(), i = reader.nextInt(), t = reader.nextInt(), output = 0;//kitten
        int[] likes = new int[i];
        for (int j = 0; j < f; j++) { = reader.next();
            for (int k = 0; k < i; k++)
                if (input.charAt(k) == 'Y')
                    likes[k]++;
        } j = 0; j < i; j++)
            if (likes[j] >= t)
                output++;
        System.out.println(output);


import java.util.Scanner;
public class ga1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
		int r = scanner.nextInt();
		int t = scanner.nextInt();
        scanner.nextLine();
		//
		int a[] = new int[r];
        String s = new String;
        for(int i = 0; i < n; i++){
            s = scanner.nextLine();
			for(int j = 0; j < r; j++){
				if(s.charAt(j) == 'Y'){
				    a[j]++;
				}
			}
        }
		int k = 0 ;
        for(int i = 0; i < r; i ++){
			if(a[i] >= t){
				k++;
			}
        }
        System.out.println(k);
    }
}


import java.io.*;
import java.util.ArrayList;
import java.util.Collections;

/**
 * Created by Arthur on 3/14/2015.
 */
public class Main {

    AtomScanner sc;
    PrintWriter pw;

    public Main(AtomScanner sc, PrintWriter pw) {
        this.sc = sc;
        this.pw = pw;
        solve();
        close();
    }

    public static void main(String[] args) {
        new Main(new AtomScanner(System.in), new PrintWriter(System.out));
    }

    private void close() {
        sc.close();
        pw.close();
    }

    private void solveE() {
        int n = sc.nextInt();

    }

    private void solve() {
        int f, c, t;
        f = sc.nextInt();
        c = sc.nextInt();
        t = sc.nextInt();
        char[][] cc = new char[f][c];
        for (int i = 0; i < f; i++) {
            for (int j = 0; j < c; j++) {
                cc[i][j] = sc.nextChar();
            }
        }
        int ans = 0;
        for (int i = 0; i < c; i++) {
            int cnt = 0;
            for (int j = 0; j < f; j++) if (cc[j][i] == 'Y') cnt++;
            if (cnt >= t) ans++;
        }
        pw.println(ans);
    }
}
//adsfsadfasdfs
class Pi implements Comparable<Pi> {

    int f, s;

    Pi(int f, int s) {
        this.f = f;
        this.s = s;
    }

    @Override
    public int compareTo(Pi pi) {
        if (f > pi.f) return 1;
        if (f < pi.f) return -1;
        if (s > pi.s) return 1;
        return s == pi.s ? 0 : -1;
    }

    @Override
    public String toString() {
        return f + " " + s;
    }
}

class Pl implements Comparable<Pl> {

    long f, s;

    Pl(long f, long s) {
        this.f = f;
        this.s = s;
    }

    Pl() {
        this(0, 0);
    }

    @Override
    public int compareTo(Pl pl) {
        if (f > pl.f) return 1;
        if (f < pl.f) return -1;
        if (s > pl.s) return 1;
        return s == pl.s ? 0 : -1;
    }

    @Override
    public String toString() {
        return "(" + f + "; " + s + ")";
    }
}

class Pair<F, S> {
    F first;
    S second;

    Pair(F first, S second) {
        this.first = first;
        this.second = second;
    }

    public int hashCode() {
        int hashFirst = first != null ? first.hashCode() : 0;
        int hashSecond = second != null ? second.hashCode() : 0;

        return (hashFirst + hashSecond) * hashSecond + hashFirst;
    }

    public boolean equals(Object other) {
        if (other instanceof Pair) {
            Pair otherPair = (Pair) other;
            return
                    ((this.first == otherPair.first ||
                            (this.first != null && otherPair.first != null &&
                                    this.first.equals(otherPair.first))) &&
                            (this.second == otherPair.second ||
                                    (this.second != null && otherPair.second != null &&
                                            this.second.equals(otherPair.second))));
        }

        return false;
    }

    public static <F extends Comparable, S extends Comparable> ArrayList<Pair<F, ArrayList<S>>> groupsPairs (ArrayList<Pair<F, S>> pairs) {
        ArrayList<Pair<F, ArrayList<S>>> result = new ArrayList<>();
        pairs.stream().sorted(Pair::compare).forEach(pair -> {
            if (result.isEmpty() || !pair.first.equals(result.get(result.size() - 1).first)) {
                result.add(new Pair<>(pair.first, new ArrayList<>()));
            }
            result.get(result.size() - 1).second.add(pair.second);
        });
        return result;
    }

    public static <F extends Comparable, S extends Comparable> int compare (Pair<F, S> a, Pair<F, S> b) {
        return a.first.compareTo(b.first) != 0 ? a.first.compareTo(b.first) : a.second.compareTo(b.second);
    }
}

class AtomScanner {

    final static int BUFFER_SIZE = 65536;

    BufferedReader br;
    char[] buf = new char[BUFFER_SIZE];
    int len = 0;
    int it = 0;
    boolean end = false;

    boolean delim(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    void fillBuffer() {
        try {
            len = br.read(buf);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void ensureBuffer() {
        if (it == len) {
            it = 0;
            fillBuffer();
            if (len == -1) end = true;
        }
    }

    void moveNext() {
        while (!end) {
            ensureBuffer();
            if (!delim(buf[it])) return;
            while (it < len && delim(buf[it])) it++;
        }
    }

    char nextChar() {
        moveNext();
        if (end) throw new NullPointerException("End was reached");
        return buf[it++];
    }

    String next() {
        moveNext();
        StringBuilder sb = new StringBuilder();
        while (!end) {
            int l = it;
            while (++it < len && !delim(buf[it]));
            sb.append(buf, l, it - l);
            ensureBuffer();
            if (delim(buf[it])) break;
        }
        return sb.toString();
    }

    int nextInt() {
        moveNext();
        boolean e = false;
        if (buf[it] == '-') {
            e = true;
            it++;
            ensureBuffer();
        }
        int result = 0;
        while (!end) {
            int l = it;
            while (it < len && !delim(buf[it])) {
                result = (result * 10) + buf[it] - '0';
                it++;
            }
            ensureBuffer();
            if (end || delim(buf[it])) break;
        }
        if (e) result *= -1;
        return result;
    }
    long nextLong() {
        moveNext();
        long result = 0;
        while (!end) {
            int l = it;
            while (it < len && !delim(buf[it])) {
                result = (result * 10) + buf[it] - '0';
                it++;
            }
            ensureBuffer();
            if (delim(buf[it])) break;
        }
        return result;
    }

    AtomScanner(String file) {
        try {
            br = new BufferedReader(new FileReader(file), BUFFER_SIZE);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    AtomScanner(InputStream is) {
        br = new BufferedReader(new InputStreamReader(is), BUFFER_SIZE);
    }

    public void close() {
        try {
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


import java.io.*;

public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(),
            m = in.nextInt(),
            t = in.nextInt(),
            ans = 0,
            i = 0, j;
        int[] res = new int[m];
        for (; i < n; ++i) {
            String s = in.next();
            for (j = 0; j < m; ++j)
                if (s.charAt(j) == 'Y')
                    ++res[j];
        for (i = 0; i < m; ++i)
            if (res[i] >= t)
                ++ans;
        System.out.println(ans);
    }
}


import java.io.*;import java.util.*;public class B {        public static void main(String[] args) throws IOException {                // TODO Auto-generated method stub                BufferedReader r=new BufferedReader(new InputStreamReader(System.in));                String s=r.readLine();                int m=Integer.parseInt(s);                boolean[][] adj=new boolean[5][5];        while(m-->0){                s=r.readLine();                String[]sp=s.split(" ");                int from=new Integer(sp[0])-1;                int to=new Integer(sp[1])-1;                adj[from][to]=true;                adj[to][from]=true;        }                for (int i = 0; i < adj.length; i++) {                for (int j = i+1; j < adj.length; j++) {                        for (int k = j+1; k < adj.length; k++) {                                if(adj[i][j]&&adj[i][k]&&adj[j][k]){                                        System.out.println("WIN");                                        return;                                }                                if(!adj[i][j]&&!adj[i][k]&&!adj[j][k]){                                        System.out.println("WIN");                                        return;                                }                                                        }                }        }                System.out.println("FAIL");        }}


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

public class Main {

	private static BufferedReader input;	// ���� ����� ����� ������ ��������� ������ �� ������-���� ������
	private static PrintWriter output;	// ���� ����� ����� ������ ������ ������
	private static StreamTokenizer stoken;	// ���� ����� ������ ����� ��������� ���������� �������. �� ��������� ����������� - ������

	static String fin = "input";
	static String fout = "output";

	private static void solve() throws IOException{
		int n = nextInt();
		int[] mas = new int[5];
		for (int i = 0; i<n; i++){
			int a = nextInt();
			int b = nextInt();
			mas[a]++;
			mas[b]++;
		}
		boolean key = false;
		for (int i=0; i<5; i++){
			if (mas[i]>=3){
				key = true;
				break;
			}
		}

		if (key){
			output.print('WIN');
		}else{
			output.print('FAIL');
		}
	}

	public static void main(String[] args) throws IOException {
		//�������� ������
		input = new BufferedReader(new InputStreamReader(System.in));
		output = new PrintWriter(System.out);

		//�������� ������
		//input = new BufferedReader(new FileReader(fin + ".txt"));
		//output = new PrintWriter(new FileWriter(fout + ".txt"));

		stoken = new StreamTokenizer(input);

		//����� �������
		solve();

		//�������� �����
		input.close();
		//����� ������
		output.flush();
		//�������� �����
		output.close();
	}

	//��������� 32-������ ����� �����
	private static int nextInt() throws IOException {
		return (int) nextDouble();
	}

	//��������� 64-������ ����� �����
	private static long nextLong() throws IOException {
		return (long) nextDouble();
	}

	//��������� 64-������ ������� �����
	private static double nextDouble() throws IOException {
		stoken.nextToken();
		return stoken.nval;
	}
}


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

 public class Friends {

     public static void main(String args[]) throws IOException {
         InputStreamReader isr = new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(isr);
         List<Set> acquaintance = new ArrayList<Set>();
         int m;
         String result = "FAIL";

         m = Integer.parseInt(br.readLine());

         for (int i=0; i<6; i++) {
             acquaintance.add(new HashSet<Integer>());
         }

         for (int i=0; i<m; i++) {
             int a, b;
             // Integer A, B;
             String str[] = br.readLine().trim().split(" ");
             a = Integer.parseInt(str[0]);
             b = Integer.parseInt(str[1]);
             Set temp = acquaintance.get(a);
             if (!temp.contains(b)) {
                 temp.add(b);
             }
             temp = acquaintance.get(b);
             if (!temp.contains(a)) {
                 temp.add(a);
             }
             temp = null;
         }
         System.out.println(acquaintance);
         for (int i=1; i<=3; i++) {
             for (int j=i+1; j<=4; j++) {
                 for (int k=j+1; k<=5; k++) {
                     boolean ij, ik, jk;
                     ij = acquaintance.get(i).contains(j);
                     ik = acquaintance.get(i).contains(k);
                     jk = acquaintance.get(j).contains(k);
                     // boolean temp = (ij && ik && jk) || (!ij && !ik && !jk);
                     // System.out.println(i + "," + j + "," + k + " -> " + ij + ", " +  ik + ", " + jk + " |\t" + temp);
                     if ((ij && ik && jk) || (!ij && !ik && !jk)) {
                         result = "WIN";
                         break;
                     }
                 }
                 if (result.equals("WIN")){
                     break;
                 }
             }
             if (result.equals("WIN")) {
                 break;
             }
         }
         System.out.println(result);
     }
 }


import sun.security.krb5.internal.KdcErrException;
import sun.text.normalizer.Trie;

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

public class Friends {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //BufferedReader br = new BufferedReader(new FileReader("A.txt"));
        int m = Integer.parseInt(br.readLine());
        boolean[][] isFriend = new boolean[5][5];
        for(int i = 0; i < m; ++i) {
            StringTokenizer st = new StringTokenizer(br.readLine());
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            isFriend[x-1][y-1] = isFriend[y-1][x-1] = true;
        }

        boolean win = false;
        for(int mask = 0; mask < (1 << 5); ++mask) {
            if(Integer.bitCount(mask) == 3) {
                int[] bits = new int[3];
                int k = 0;
                for(int i = 0; i < 5; ++i) {
                    if((mask & (1 << i)) != 0) {
                        bits[k] = i;
                        ++k;
                    }
                }
                if(isFriend[bits[0]][bits[1]] && isFriend[bits[1]][bits[2]] && isFriend[bits[2]][bits[0]]) {
                    System.out.println("WIN");
                    win = true;
                    break;
                }
                if(!isFriend[bits[0]][bits[1]] && !isFriend[bits[1]][bits[2]] && !isFriend[bits[2]][bits[0]]) {
                    System.out.println("WIN");
                    win = true;
                    break;
                }
            }
        }
        if(!win)
            System.out.println("FAIL");
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
public class name
{
      public static void main(String[]args)throws IOException
      {
            Scanner sc=new Scanner(System.in);
            int n;
            float c;
            n=sc.nextInt();
            c=Math.ceil(n/5);
          System.out.println((int)c);

      }
}


import java.util.Scanner;
import java.lang.Math;
/**
 *
 * @author admin
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner ab = new Scanner(System.in);

              int dd = ab.nextInt();

           }

double e = Math.floor(dd/5);

int f = (int) e +1;

System.out.print(f);

    }


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

import java.util.Scanner;

/**
 *
 * @author PC
 */
public class Elefante {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //int n;
		int n = in.nextInt();
        //n = 13;

        //if (1< n && n < 1000000){
		if (1<= n && n < = 1000000){
            int a;
            if (n % 5 == 0) {
                //System.out.println("entro a par");
                a = 0;
            }else
            {
                //System.out.println("entro a impar");
                a=1;
            }

            a=a+n/5;

            System.out.println(a);
        }

    }
}


import java.util.*;

public class MyClass {
    public static void main(String args[]) {
      Scanner in = new Scanner(System.in);
      int n;
      n = in.nextInt();
      if(n % 5 == 0) {
          System.out.println(n/5);
      } else if(n % 5 != 0) {
          System.out.println((n/5) + 1);
      }
}


public class Main{
    public static void main (String args[])  {
     Scanner sc =new Scanner(System.in);
        int x1=sc.nextInt();
        int y1=sc.nextInt();
        int x2=sc.nextInt();
        int y2=sc.nextInt();
     System.out.println((1+(y2-y1)/2)*(1+(x2-x1)/2)+((y2-y1)/2)*((x2-x1)/2));
    }
 }


import java.utils.*;

 public class Main{
    public static void main (String args[])  {
     Scanner sc =new Scanner(System.in);
        int x1=sc.nextInt();
        int y1=sc.nextInt();
        int x2=sc.nextInt();
        int y2=sc.nextInt();
     System.out.println((1+(y2-y1)/2)*(1+(x2-x1)/2)+((y2-y1)/2)*((x2-x1)/2));
    }
 }


public class Main{
    public static void main (String args[]  {
        int x1=sc.nextInt();
        int y1=sc.nextInt();
        int x2=sc.nextInt();
        int y2=sc.nextInt();
     System.out.println((1+(y2-y1)/2)*(1+(x2-x1)/2)+((y2-y1)/2)*((x2-x1)/2));
    }
}


import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class E {

	public static boolean is_center(final long x, final long y){
		final long x_sign = Math.abs(x) % 2;
		final long y_sign = Math.abs(y) % 2;

		return x_sign == y_sign;
	}

	public static long calc_y_size(final long x, long y1, long y2){
		if(x % 2 == 0){
			if(y1 % 2 == 0){ y1--; }
			if(y2 % 2 == 0){ y2++; }

			return (y2 - y1) / 2;
		}else{
			if(y1 % 2 == 1){ y1--; }
			if(y2 % 2 == 1){ y2++; }

			return (y2 - y1) / 2;
		}
	}

	public static void main(String[] args) {
		try (final Scanner sc = new Scanner(System.in)) {
			final long x1 = sc.nextLong();
			final long y1 = sc.nextLong();
			final long x2 = sc.nextLong();
			final long y2 = sc.nextLong();

			if(x1 == x2){
				System.out.println(calc_y_size(x1, y1, y2));
				return;
			}

			final long x1_y_size = calc_y_size(x1, y1, y2);
			final long x1_1_y_size = calc_y_size(x1 + 1 + 1, y2, y2);

			System.out.println(x1_y_size * (x2 - x1) / 2 + x1_1_y_size * ((x2 - x1) - ((x2 - x1) / 2));

			long answer = 0;

			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

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

		private void getLine() {
			try {
				while (!hasNext()) {
					tok = new StringTokenizer(br.readLine());
				}
			} catch (IOException e) { /* ignore */
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() {
			getLine();
			return tok.nextToken();
		}

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

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

		public void close() {
			try {
				br.close();
			} catch (IOException e) { /* ignore */
			}
		}
	}
}


import java.util.Scanner;

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

        long k = r.nextInt();
        long b = r.nextInt();

        long n = r.nextInt();
        long t = r.nextInt();

        int counter = 0;
        long curr = 1;
        while(true){
            if(t == curr){
                System.out.println(Math.max(0, n - counter));
                return;
            }else if(curr > t){
                System.out.println(Math.max(0, 1 + n - counter));
                return;
            }

            curr = k * curr + b;
            cnt++;
        }

    }
}


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

public class Main
{
	public static void main (String[]args)
	{
			Scanner scan = new Scanner (new BufferedInputStream (System.in));
			//int tc = scan.nextInt();

			//for(int i=0;i<tc;i++)
//			{
				int k = scan.nextInt();
				int b = scan.nextInt();
				int n = scan.nextInt();
				int m = scan.nextInt();
				int t =1;
				int flag=0;
				for(int j=0;j<n;j++)
				{
					t=t*k+b;
					if(t>m)
					{
						System.out.println("Case #"+(i+1)+": "+(n-j));
						flag=1;
						break;
					}
				}

				if(flag==0)
					System.out.println("Case #"+(i+1)+": 0");

		//	}

	}

}


public class N4_CF_199C {
    public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    long k = in.nextInt(), b = in.nextInt(), n = in.nextInt(), t = in
        .nextInt();
    long z = 0;
    if (k == 1) {
        z = 1l + n * b;
        long zt = t + n * b;
        while (zt > z && n > -1) {
        n--;
        zt = t + n * b;
        }
        System.out.println((n + 1));
    } else {
        long p = (long) Math.pow(k, n);
        z = p + b * ((1 - p) / (1l - k));
        long zt = p * t + b * ((1 - p) / (1l - k));
        while (zt > z && n > -1) {
        n--;
        p = (long) Math.pow(k, n);
        zt = p * t + b * ((1 - p) / (1l - k));
        }
        System.out.println((n + 1));
    }
    }
}


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

public class Contest1_1{

    public static void main(String ar[]) throws Exception {

        BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tok = new StringTokenizer(buff.readLine());
        BigInteger k = new BigInteger(tok.nextToken());
        BigInteger b = new BigInteger(tok.nextToken());
        int n = Integer.parseInt(tok.nextToken());
        BigInteger t = new BigInteger(toak.nextToken());
        BigInteger z = new BigInteger("1");
        for(int i =0;i<n;i++){
            z = z.multiply(k);
            z = z.add(b);
        }
        int count =0;
        while(t.compareTo(z)==-1){
            t = t.multiply(k);
            t = t.add(b);
            count++;
        }
        System.out.println(count);
    }
}


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

public class Main {

    public static void main( String[] args ) {

        BufferedReader bis = new BufferedReader(new InputStreamReader(System.in));
        // BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int s = in.nextInt(), x1 = in.nextInt(), x2 = in.nextInt();
        int t1 = in.nextInt(), t2 = in.nextInt();
        int p = in.nextInt(), d = in.nextInt();

        int answ0 = Math.abs(x1 - x2) * t2;
        int answ = Math.abs(x1 - x2) * t;
        while (true){
            if (p == x1 && (x2 - x1) * d > 0) break;

            p += d;
            answ += t1;
            if (p == s){
                d = -1;
            }else if (p == 0){
                d = 1;
            }
        }
        out.print(Math.min(answ0, answ));
        out.flush();
    }

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

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

    }
}


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

public class CF746C{
  public static int index;
  public static void main(String[] args)throws Exception {
    InputReader in = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    int s = in.nextInt(), x = in.nextInt(), y = in.nextInt();
    int t1 = in.nextInt(), t2 = in.nextInt();
    int p = in.nextInt(), d = in.nextInt();

    int min = Math.abs(y-x)*t2;

    for(int i = 0; i <= s; i++){
      int dd = Math.abs(i-x);
      int t = dd*t2;

      int tempD = d;
      int tempP = p;
      int tempT = 0;

      while(tempP != i || tempT < t){
        if(tempP == 0 || tempP == s){
          if(tempD == 1) tempD = -1;
          else tempD = 1;
        }
        if(tempD == 1) tempP++;
        else tempP--;

        tempT += t1;
        //System.out.println(i+" "+tempP+" "+tempD);

      }

      int remD = Math.abs(y - tempP);

      if(tempD == 1 && tempP < y){
        remD = Math.abs(y-tempP);
      }
      else if(tempD == 1 && tempP > y){
        remD = Math.abs(s-tempP) + Math.abs(s-y);
      }
      if(tempD == -1 && tempP > y){
        remD = Math.abs(y-tempP);
      }
      else if(tempD == -1 && tempP < y){
        remD = tempP + y;
      }

      int curT = remD*t1 + tempT;

      //System.err.println(i+" "+curT+" "+remD+" "+tempT);

      min = Math.min(curT, min);

    }

    pw.println(min);

    pw.close();
  }

//  static class Node{
//    public int a, r;
//    public Node(int aa, int rr){
//      a = aa; r = rr;
//    }
//
//  }

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

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

    public String next()throws Exception {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
        tokenizer = new StringTokenizer(reader.readLine());
      return tokenizer.nextToken();
    }

    public String nextLine()throws Exception {
      String line = null;
      tokenizer = null;
      line =  reader.readLine();
      return line;
    }

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

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

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

  }
}


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

public class Main {

	static InputReader in = new InputReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	static final int oo = (int)1e9;
	static int M = 105;

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

		int s = in.nextInt();
		int x1 = in.nextInt();
		int x2 = in.nextInt();

		int t1 = in.nextInt();
		int t2 = in.nextInt();

		int p = in.nextInt();
		int d = in.nextInt();

		int dist = Math.abs(x2 - x1);
		int distb = 0;
		int l, r;
		while(true) {
			if(p == x2) {
				if(d == 1) {
					l = x2;
					r = s;
					distb += (s - x2) * 2;
				}
				else {
					l = 0;
					r = x2;
					distb += 2 * x2;
				}
			}
			else {
				if( Integer.signum(x2 - p) == Integer.signum(d) ) {
					l = Math.min(x2, p);
					r = Math.max(x2, p);
					distb += Math.abs(x2 - p);
				}
				else if(d == -1) {
					l = 0;
					r = x2;
					distb += (p + x2);
				}
				else {
					l = x2;
					r = s;
					distb += (2 * s - p - x2);
				}
				p = x2;
			}
			if(l <= x1 && x1 <= r)
				break;
		}

		int ans = Math.min( dist * t2, distb * t1 );
		System.out.println(ans);

		out.close();
	}

	static int lower_bound(long[] a, int n, long k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}
}

class InputReader {

	private final InputStream stream;
	private final byte[] buf = new byte[8192];
	private int curChar, snumChars;

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

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

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			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 {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

	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 String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

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

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

}


//package codeforce;

import java.util.Scanner;

public class Div2R386C {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int s = scan.nextInt();
		int x1 = scan.nextInt(), x2 = scan.nextInt();
		double v1 = (double)1/(scan.nextInt()), v2 = (double)1/(scan.nextInt());
		//System.out.println(v1 + " " + v2);

		int p = scan.nextInt(), d = scan.nextInt();
		int i_d = -1, end = 0;
		if(x1 < x2) {i_d = 1;}
		if(d == 1) end = s;
		int path = 0;
		while(Math.signum((double)x1 - p) != Math.signum((double)i_d) || i_d != d){
			path += Math.abs(p - end);
			p = end;
			end = s - end;
			d = -d;
		}
		path += Math.abs(x1-p);
		double distance = Math.abs(x1- x2);
		double time_to_catch = path/Math.abs(v1- v2);
		long ans = 0;
		if(time_to_catch * v2 >= distance || v1 <= v2){
			ans = Math.round(distance/v2);
		} else {
			ans = Math.round(time_to_catch + (distance - time_to_catch*v2)/v1);
		}
		System.out.println(ans);
	}
}