import java.io.*;

public class problem {
    static void solve() throws IOException {
        Reader in = new Reader();
        int n = in.nextInt();
        int k = in.nextInt();
        int a[] = new int[k];
        int countOdd = 0;
        int countEven = 0;
        int doubleRemain = 2 * n;
        int quadraticRemain = n;
        int totalQuad = 0;
        for (int i = 0; i < k; i++) {
            a[i] = in.nextInt();
            totalQuad += a[i] / 4;
            if (a[i] % 4 == 2) countEven++;
            if (a[i] % 4 == 1) countOdd++;
            if (a[i] % 4 == 3) {
                countOdd++;
                countEven++;
            }
        }
        int res;
        if (totalQuad > quadraticRemain) {
            countEven += 2 * (totalQuad - quadraticRemain);
            res = doubleRemain - countEven - countOdd;
        } else {
            quadraticRemain -= totalQuad;
            int min = Math.min(Math.min(quadraticRemain, countEven), countOdd);
            quadraticRemain -= min;
            countEven -= min;
            countOdd -= min;
            if (countEven == 0) doubleRemain += 2 * quadraticRemain;
            else if (countOdd == 0) {
                doubleRemain += 3 * (quadraticRemain / 2) + quadraticRemain % 2;
            }
            res = doubleRemain - countEven - countOdd;
        }

        System.out.println(res >= 0 ? "YES" : "NO");
    }

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

    static class Reader {

        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    break;
                }
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg) {
                return -ret;
            }
            return ret;
        }

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

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg) {
                return -ret;
            }
            return ret;
        }

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

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) {
                return;
            }
            din.close();
        }
    }
}


import java.util.*;

public class CodeForces {
    public static void main(String[] args) {
       Scanner scanner = new Scanner(System.in);
       String str = scanner.nextLine();
       String res = "NO";
       for(char ch : str.toCharArray()) {
           if(ch == 'H' || ch == 'Q' || ch == '9')
               res = "YES";
       }
        System.out.println(res);
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        long Por = in.nextLong(), Kor = in.nextLong();
        BigInteger K = BigInteger.valueOf(Kor), P = BigInteger.valueOf(Por);

        K = K.multiply(BigInteger.valueOf(-1));
        ArrayList<Integer> data = new ArrayList<Integer>();
        BigInteger coef = BigInteger.ONE;
        while (P != BigInteger.ZERO) {
            int cur = 0;
            BigInteger absCo = coef.abs(), absP = P.abs(), absK = K.abs();
            while (absP.remainder(absCo) == BigInteger.ZERO && absP.divide(absCo).remainder(absK) != BigInteger.ZERO) {
                P = P.subtract(coef);
                absP = P.abs();
                cur++;
            }
            data.add(cur);
            coef = coef.multiply(K);
        }

        System.out.println(data.size());
        for (int i = 0; i < data.size(); i++) {
            System.out.print(data.get(i) + " ");
        }
        System.out.println();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

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

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

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


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class A_349 {

    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
    public static void main(String[] args) throws IOException {
    	br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int first = 0, last = 0;
        for (int i = 1; i <= n; i++) {
			int k = nextInt();
			if(k==1){
				first = i;
			}
			if(k==n){
				last = i;
			}
		}
        int res1 = Math.max(n-last, last-1);
        int res2 = Math.max(n-first, first-1);
        pw.println(Math.max(res1,res2));

        pw.close();
    }

	private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    private static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    private static String next() throws IOException {
        while (st==null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
}
class Point{
	double x;
	double y;
	Point (double x, double y){
		this.x=x;
		this.y=y;
	}
}


import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        char[] chars = s.toCharArray();
        boolean a = false;

        StringBuilder buf = new StringBuilder(s);

        for (int i = 1; i < s.length();i++) {
            if (Character.isUpperCase(chars[0])) {
                a = true;
            }
        }

        if (s.equals(buf.toString().toUpperCase())){
            System.out.print(buf.toString().toLowerCase());
        }
        else if (a = true ) {
            if (buf.substring(1).equals(buf.substring(1).toUpperCase()))
                System.out.print(buf.substring(0,1).toUpperCase()+buf.substring(1).toLowerCase());
            else
                System.out.print(s);
        }
        else System.out.print(s);
    }
}


import java.util.*;

public class HelloWorld {
    static int mod = 998244353;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long n = scan.nextLong();
        long m = scan.nextLong();
        int ans=0;
        for(int i=1; i<=n; i++){
            ans = add(ans, binPow((int)(m%mod), i));
        }
        long curr=1;
        int count=1;
        for(int i=1; i<=n; i++){
            if(curr>m)
                continue;
            if(isPrime(i))
                curr *= i;
            count = mul(count, (int)((m/curr)%mod));
            ans = sub(ans, count);
        }
        System.out.println(ans);
    }
    static boolean isPrime(long n){
        if(n<=1)
            return false;
        for(long i=2; i*i<=n; i++){
            if(n%i==0)
                return false;
        }
        return true;
    }
    static int binPow(int x, int y){
        int z=1;
        while(y!=0){
            if((y&1) != 0){
                z = mul(z, x);
            }
            x = mul(x, x);
            y >>= 1;
        }
        return z;
    }
    static int add(int x, int y){
        x += y;
        while(x >= mod)
            x -= mod;
        while(x < 0)
            x += mod;
        return x;
    }
    static int sub(int x, int y){
        return add(x, -y);
    }
    static int mul(int x, int y){
        return (int) ((x * 1l * y) % mod);
    }
}


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

/**
 * @author avcbcoder last modified @23-Jun-2018 @10:09:41 PM 491 Div2 - TODO
 */

public class C_ {
	public static void main(String[] args) throws Exception {
		// solve(39259424579862572L, 1000000000000000000L);
		// solve(1, 43);
		// while (true)
		calc(sc.nextLong());
	}

	private static long calc(long n) {
		long lo = 1, hi = 1000000000000000001L;
		// minimize k i.e mid , if we got ans move to left
		// otherwise move to right
		long min = Long.MAX_VALUE;
		ArrayList<Long> ans = new ArrayList<>();
		while (lo <= hi) {
			long mid = (lo + hi) / 2;
			boolean curr = solve(mid, n);
			if (curr) {
				min = Math.min(min, mid);
				ans.add(mid);
				hi = mid - 1;
			} else {
				lo = mid + 1;
			}
		}
		// Collections.sort(ans);
		// for (long l : ans) {
		// if (solve(l, n)) {
		// System.out.println(l);
		// return l;
		// }
		// }
		System.out.println(min);
		return min;
	}

	private static boolean solve(long k, long n) {
		long initial = n;
		long v = 0, p = 0;// p is 10% and v is k
		long i = 0;
		while (n != 0) {
			if (i % 2 == 0) {
				// v
				// long eat;
				// if (n >= k) {
				// eat = k;
				// } else {
				// eat = n;
				// }
				// v += eat;
				// n -= eat;
				v += Math.min(n, k);
				n -= Math.min(n, k);
			} else {
				// p
				if (n >= 10) { // now he can eat
					// long eat = (long) (Math.floor((n * 1.0) / 10.0));
					long eat = n / 10;
					n -= eat;
					p += eat;
				}
			}
			i++;
		}
		// double h=(initial * 1.0) / (2);
		if (v * 2 >= initial) {
			return true;
		} else
			return false;
	}

	public static InputStreamReader r = new InputStreamReader(System.in);

	public static BufferedReader br = new BufferedReader(r);

	public static Scanner sc = new Scanner(System.in);
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;

public class main {
    public static void main(String[] args) {
        try
        {
            InputStreamReader converter = new InputStreamReader(System.in);
            BufferedReader reader = new BufferedReader(converter);
            String line= null;
            line = reader.readLine();
            HashSet<Character> map = new HashSet<Character>();
            for (int i=0;i<line.length();++i)
            {
                map.add(line.charAt(i));
            }
            if (map.size()%2==0)
            {
                System.out.print("CHAT WITH HER!");
            }
            else
            {
                System.out.print("IGNORE HIM!");
            }
        }
        catch(Exception e)
        {
            System.out.print(e);
        }
    }
}


import java.io.*;
import java.util.*;
public class Main
{
	private List<Long> list=new ArrayList<>();
	public static void main(String args[])throws IOException
	{
		new Main().run();
	}
	void run()throws IOException
	{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter ob=new PrintWriter(System.out);
		generateSuperLuckyNumbers();
		Collections.sort(list,new Comparator<Long>(){
			public int compare(Long a,Long b)
			{
				return a.compareTo(b);
			}
		});
		long x=Integer.parseInt(in.readLine());
		for(long i : list) {
			if (i>=x)
				{
					ob.println(i);
					ob.flush();
					return;
			    }
		}
	}
	void generateSuperLuckyNumbers()
	{
		for(int i=1;i<=5;i++)
			generate(i,i,0L);
	}
	void generate(int four,int seven,long number)
	{
		if(four==0 && seven==0)
		{
			list.add(number);
			return;
		}
		if(four>0)
			generate(four-1,seven,(number*10)+4);
		if(seven>0)
			generate(four,seven-1,(number*10)+7);

	}
}


import java.util.*;

public class Contest {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		if (n+(n-1)<k) {
			System.out.println(0);
		}else if(n-1>=k) {
			System.out.println((k-1)/2);
		}else {
			long min = Math.max(k-n, 1);
			long max = k-min+1;
			System.out.println((max-min)/2);
		}
	}

}


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

public class Main {

    public static void main(String [] args) {
        final FastScanner scanner = new FastScanner();
        int n = scanner.nextInt(), l = scanner.nextInt(), r = scanner.nextInt();
        System.out.println(min(n, l) + " " + max(n, r));
    }

    static int max(int n, int r) {
        int sum = 0;
        int start = 1, curr = 1, unique = 0;
        for (int i = 0; i < n; i++) {
            if (unique < r) {
                sum += start;
                curr = start;
                start *= 2;
                unique ++;
            } else {
                sum += curr;
            }
//            System.out.println(sum);
        }
        return sum;
    }

    static int min(int n, int l) {
        int start = 1;
        int sum = 0;
        for (int i = 0; i < l; i++) {
            sum += start;
            start *= 2;
        }

        for (int i = l; i < n; i++) {
            sum += 1;
        }
        return sum;
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


import java.util.Scanner;

public class Nuts {

	private static int k;
	private static int a;
	private static int b;
	private static int v;
	private static int boxesNumber;

	public static void main(String[] args) {

		boxesNumber = 0;

		Scanner scanner = new Scanner(System.in);
		String input = scanner.nextLine();
		String[] parts = input.split(" ");

		k = Integer.parseInt(parts[0]);
		a = Integer.parseInt(parts[1]);
		b = Integer.parseInt(parts[2]);
		v = Integer.parseInt(parts[3]);

		/*---------------------------------*/

		while (a > 0) {
			boxesNumber++;
			if (b > 0) {
				a -= v*(Math.min(b, k-1) + 1);
				b -= Math.min(b, k-1);
			} else {
				a -= v;
			}
		}

		System.out.println(boxesNumber);
	}
}


import java.util.*;

public class lolat {
	static int n;

	static long[][] memo;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			n = in.nextInt();
			int k = in.nextInt();
			memo = new long[n + 1][k + 1];
			for (int i = 0; i <= n; i++) {
				Arrays.fill(memo[i], -1);
			}
			System.out
					.println(callRecusive(1, k) % 1000000007);
		}
	}

	private static long callRecusive(int num, int len) {
		// TODO Auto-generated method stub
		if (len == 0) {
			return 1;
		}
		if (memo[num][len] != -1)
			return memo[num][len];
		long s = 0;
		for (int i = num; i <= n; i += num) {
			s += callRecusive(i, len - 1);
		}
		return (memo[num][len] = s % 1000000007);
	}

}


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

//Mann Shah [ DAIICT ].
//fast io

public class Main {
	static int mod = (int) (1e9+7);
	static InputReader in;
    static PrintWriter out;

	public static void main(String args[] )  {

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

	    long t = in.nextLong();
	    long s = in.nextLong();
	    long x = in.nextLong();

	    x -= t;
	    if(x==0) {
	    		out.println("YES");
	    }
	    else if(x<0) {
	    		out.println("NO");
	    }
	    else {
	    	if(x<s) {
	    		out.println("NO");
	    	}
	    	else {
	    if(x%s==0 || x%s==1) {
	    		out.println("YES");
	    }
	    else {
	    		out.println("NO");
	    }}}

	    out.close();
	}

/* TC space

 */

		static class InputReader
	    {

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

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

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

	        public long nextLong()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                int sgn = 1;
	                if (c == '-')
	                {
	                        sgn = -1;
	                        c = snext();
	                }
	                long res = 0;
	                do
	                {
	                        if (c < '0' || c > '9')
	                                throw new InputMismatchException();
	                        res *= 10;
	                        res += c - '0';
	                        c = snext();
	                } 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 long[] nextLongArray(int n)
	        {
	                long a[] = new long[n];
	                for (int i = 0; i < n; i++)
	                {
	                        a[i] = nextLong();
	                }
	                return a;
	        }

	        public ArrayList<Integer> nextArrayList(int n){
	        			ArrayList<Integer> x = new ArrayList<Integer>();
	        			for(int i=0;i<n;i++) {
	        				int v = in.nextInt();
	        				x.add(v);
	        			}
	        			return x;
	        }

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

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

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

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

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

	    }

}

//Pair arr[] = new Pair[n];
//arr[0] = new Pair(10, 20);
 class Pair {
    int x;
    int y;

    // Constructor
public Pair(int x, int y)
    {
        this.x = x;
        this.y = y;
    }
}
// class Compare {
//	  //void return by default.
//    static Pair[] compare(Pair arr[], int n)
//    {
//        // Comparator to sort the pair according to first element.
//        Arrays.sort(arr, new Comparator<Pair>() {
//            @Override public int compare(Pair p1, Pair p2)
//            {
//                return p1.x - p2.x;
//            }
//        });
//
//
//        return arr;
//       /* for (int i = 0; i < n; i++) {
//            System.out.print(arr[i].x + " " + arr[i].y + " ");
//        }
//        System.out.println(); */
//    }
//}

class couple implements Comparable<couple>
{ int x,y;
  public couple(int m,int f) {
 	 x=m;
 	 y=f;
  }
	public int compareTo(couple o) {

		return x-o.x;
	}
}


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

public class Main {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		int[] a = new int[n + 1];
		st = new StringTokenizer(br.readLine());
		for (int i = 1; i <= n; i++)
			a[i] = Integer.parseInt(st.nextToken());
		int l = m, r = m;
		while (l > 1) {
			l--;
			if (a[l] != 0 && a[l] <= k)
				break;
		}
		while (r < n) {
			r++;
			if (a[r] != 0 && a[r] <= k)
				break;
		}
		int disL = -1, disR = -1;
		if (l == m || a[l] > k || a[l] == 0)
			disL = 100;
		else {
			disL = m - l;
		}
		if (r == m || a[r] > k || a[r] == 0)
			disR = 100;
		else {
			disR = r - m;
		}

		System.out.println(Math.min(disL, disR) * 10);

	}

}


import java.util.*;

public class Factory{

	public static boolean productionWillStop(long a, long m){
		for (int i = 0; i < 100000; i++) {
			if (a % m == 0){
				System.out.println("Yes");
				return true;
			}
			a += a % m;
		}
		System.out.println("No");
		return false;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		long m = in.nextLong();
		productionWillStop(a, m);
	}
}


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

public class Solution implements Runnable {

    public void solve() throws Exception {
            int r1 = sc.nextInt();
            int c1 = sc.nextInt();
            int r2 = sc.nextInt();
            int c2 = sc.nextInt();
            if(r1 == r2 && c1 == c2) out.print(0 + " ");
                else if(r1 == r2 || c1 == c2) out.print(1 + " ");
                    else out.print(2 + " ");
            if((r1 + c1) % 2 != (r2 + c2) % 2) out.print(0 + " ");
                else if(abs(r1 - r2) == abs(c1 - c2)) out.print(1 + " ");
                else out.print(2 + " ");
            int count = 0;
            while(r1 != r2 || c1 != c2) {
                if(r1 != r2) {
                    if(r1 > r2) r1--;
                        else r1++;
                }
                if(c1 != c2) {
                    if(c1 > c2) {
                        c1--;
                    }else c1++;
                }
                count ++;
            }
            out.println(count);
            out.flush();
    }

    static Throwable throwable;
    BufferedReader in;
    PrintWriter out;
    FastScanner sc;

    public static void main(String[] args) throws Throwable {
        Thread thread = new Thread(null, new Solution(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Solution.throwable != null)
            throw throwable;
    }

    public void run() {
        try {
//          in = new BufferedReader(new InputStreamReader(new FileInputStream("game.in")));
//          out = new PrintWriter(new FileWriter("game.out"));
                        in = new BufferedReader(new InputStreamReader(System.in));
                        out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            solve();
        } catch (Throwable throwable) {
            Solution.throwable = throwable;
        } finally {
            out.close();
        }
    }
}

class FastScanner {
    BufferedReader reader;
    StringTokenizer strTok;

    FastScanner(BufferedReader reader) {
        this.reader = reader;
    }

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

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

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

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


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CFProblemC {
	static long mod;

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		mod = input.nextInt();
		int h1 = input.nextInt(); // start
		int a1 = input.nextInt(); // goal
		int x1 = input.nextInt(); // x1*h1+y1 -> h1
		int y1 = input.nextInt();

		int h2 = input.nextInt();
		int a2 = input.nextInt(); // goal
		int x2 = input.nextInt();
		int y2 = input.nextInt();
		ArrayList<Long> values1 = evaluateTimes(h1, a1, x1, y1);
		ArrayList<Long> values2 = evaluateTimes(h2, a2, x2, y2);
		int index1 = 0;
		int index2 = 0;
		while (index1 < values1.size() && index2 < values2.size()) {
			if (values1.get(index1).equals(values2.get(index2))) {
				break;
			}
			if (values1.get(index1).compareTo(values2.get(index2)) < 0) {
				index1++;
			} else {
				index2++;
			}
		}
		if (values1.size() > 0 && values2.size() > 0 && index1 < values1.size()
				&& index2 < values2.size()
				&& values1.get(index1).equals(values2.get(index2))) {
			System.out.println(values1.get(index1));
		} else {
			System.out.println(-1);
		}
	}

	private static ArrayList<Long> evaluateTimes(long h1, long a1, long x1,
			long y1) {
		long start = h1;
		long count = 0;
		ArrayList<Long> output = new ArrayList<Long>();
		while (count < 2 * mod + 2) {
			if (start == a1) {
				output.add(count);
			}
			count++;
			start = (start * x1 + y1) % mod;
		}
		if (output.size() == 0) {
			return output;
		} else {
			if (output.size() > 1) {
				long diff = output.get(1) - output.get(0);
				long startVal = output.get(output.size() - 1);
				for (int a = 1; a < mod + .1 * mod; a++) {
					output.add(startVal + diff * a);
				}
			}
		}
		return output;
	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(Reader in) {
			br = new BufferedReader(in);
		}

		public FastScanner() {
			this(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());
		}

		// Slightly different from java.util.Scanner.nextLine(),
		// which returns any remaining characters in current line,
		// if any.
		String readNextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.util.*;

public class Test {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double x = sc.nextDouble();
        double y = sc.nextDouble();
        double a = Math.max(x, y)-1;
        double w = (6-a)/6;
        if(w==0.5)
            System.out.println("1/2");
        else if(w==1)
            System.out.println("1/1");
        else if(w==0.3333333333333333)
            System.out.println("1/3");
        else if(w==0.16666666666666666)
            System.out.println("1/6");
        else if(w==0.6666666666666666)
            System.out.println("2/3");
        else if(w==0.8333333333333334)
            System.out.println("5/6");

    }

}


import java.io.*;
public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String cad1 = br.readLine(), cad2 = br.readLine(), cero = "011220",uno = "102102",dos = "220011";
		int answer, mov = Integer.parseInt(cad1) % 6,pos = Integer.parseInt(cad2);

		if (pos == 0) {
			System.out.println(cero.charAt(mov));
		}else{
			if (pos == 1) {
				System.out.println(uno.charAt(mov));
			}else {
				System.out.println(dos.charAt(mov));
			}
		}

	}

}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        if (s1.compareToIgnoreCase(s2) > 0) System.out.println(1);
        if (s1.compareToIgnoreCase(s2) < 0) System.out.println(-1);
        if (s1.compareToIgnoreCase(s2) == 0) System.out.println(0);
    }
}


import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.math.BigInteger;
import java.util.List;
import java.util.ArrayList;
import java.util.Queue;
import java.util.PriorityQueue;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
//https://codeforces.com/problemset/problem/385/A
//A. Bear and Raspberry
public class Problem385A
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        StringTokenizer dates=new StringTokenizer(in.readLine());
        int n=Integer.parseInt(dates.nextToken());
        int c=Integer.parseInt(dates.nextToken());
        dates=new StringTokenizer(in.readLine());
        int[] day=new int[n];
            int mayor=0;
            int i;
            int pos=0;
            for(i=0;i<n;i++)
            {
            	day[i]=Integer.parseInt(dates.nextToken());
            	if(i>0&&day[i-1]-day[i]-c>mayor)
            	{
            		mayor=day[i-1]-day[i]-c;
            		pos=i;
            	}
            }
            if(mayor<0)
            	out.println(0);
            else
            	out.println(mayor);
        out.close();
    }
}


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

public class CodeforcesSubsequences {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        long n = in.nextLong();
        char ch[] = "codeforces".toCharArray();
        int k = 2;
        long s = 1L;
        int f[] = new int[10];
        Arrays.fill(f, 1);
        while(s<n) {
        	for(int i=0;i<10;i++) {
        		s = s/(k-1) * k;
        		if(s<n) ++f[i];
        		else {
        			++f[i];break;
        		}
        	}
        	if(s>=n) break;
        	k++;
        }
        //out.println(k+" "+p);
        for(int i=0;i<10;i++) {
        	for(int j=0;j<f[i];j++) {
        		out.print(ch[i]);
        	}
        }
        out.flush();
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while(!st.hasMoreTokens())
				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());
		}

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

		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}

	}

	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}

	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}

	static long gcd(long a, long b) {
		if(b==0) return a;
		else return gcd(b,a%b);
	}
}


import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class UnluckyTicket {

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

        int n = in.nextInt();
        String number = in.next();

        char[] l = number.substring(0, n).toCharArray();
        char[] r = number.substring(n).toCharArray();

        boolean gt = true, lt = true;
        Arrays.sort(l); Arrays.sort(r);

        for (int i = 0; i < n; i++) {
            if (l[i] <= r[i]) gt = false;
            if (l[i] >= r[i]) lt = false;
        }
        out.println(gt || lt ? "YES" : "NO");
        out.close();
    }
}


import java.util.Scanner;

public class PilesWithStones {
    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int totalPiles = inp.nextInt();
        int firstVisitSum = 0;
        int secondVisitSum = 0;
        for(int i=0;i<totalPiles;i++) {
            int inpValue = inp.nextInt();
            firstVisitSum = firstVisitSum + inpValue;
        }
        for(int i=0;i<totalPiles;i++) {
            int inpValue = inp.nextInt();
            secondVisitSum = secondVisitSum + inpValue;
        }

        if (firstVisitSum>=secondVisitSum) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


import java.util.*;

public class Hexadecimal {
	public static void main(String[] args){
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		int cnt = 0;
		for(int i = 1; i <= (1<<9); i++){
			if(Integer.parseInt(Integer.toString(i,2)) <= n)
				cnt++;
		}
		System.out.println(cnt);
	}
}


import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

    public static void main(String[] args) {
        ScanReader in=new ScanReader(System.in);
        int n = in.scanInt();
        int k = in.scanInt();
        String a=in.scanString();
        ArrayList<Character> array=new ArrayList<Character>();
        for(int i=0;i<n;i++){
            if(!array.contains(a.charAt(i))){
                array.add(a.charAt(i));
            }
        }
        Collections.sort(array);
        long ans=0;
        int t=1;
        boolean aa[]=new boolean[n];
        int count=0;
        for(int i=0;i<array.size();i++){

            if(!aa[i]) {
                count++;
                if(count<=k) {
                    ans += (array.get(i) - 'a' + 1);
                }else{

                    System.out.println(ans);
                    return;
                }
                if(i+1<array.size() && (array.get(i+1)-array.get(i))<2){
                    aa[i+1]=true;
                }
            }

        }
        if(count<k){
            System.out.println("-1");
            return;
        }
        System.out.println(ans);

    }

    static  class ScanReader {
        /**
         * @author Nirav
         */
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream)   {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public String scanLine() {
            int c = scan();
            if (c == -1) return null;
            while (isWhiteSpace(c)) c = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = scan();
            } while (c != '\n' && c != -1);
            return res.toString();
        }

        public char scanChar() {
            int c = scan();
            while (isWhiteSpace(c)) c = scan();
            return (char) c;
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        public String scanString() {
            int c = scan();
            while (isWhiteSpace(c)) c = scan();
            StringBuilder RESULT = new StringBuilder();
            do {
                RESULT.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return RESULT.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

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

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

        public double scanDouble() {
            int c = scan();
            while (isWhiteSpace(c)) c = scan();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = scan();
            }
            double RESULT = 0;
            while (!isWhiteSpace(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return RESULT * Math.pow(10, scanInt());
                }
                RESULT *= 10;
                RESULT += c - '0';
                c = scan();
            }
            if (c == '.') {
                c = scan();
                double m = 1;
                while (!isWhiteSpace(c)) {
                    if (c == 'e' || c == 'E') {
                        return RESULT * Math.pow(10, scanInt());
                    }
                    m /= 10;
                    RESULT += (c - '0') * m;
                    c = scan();
                }
            }
            return RESULT * sgn;
        }

    }
}


import java.util.Scanner;

public class exercise {
	static int a[]=new int [4];;
	public static void input() {
		Scanner input=new Scanner(System.in);
		for(int i=0;i<4;i++) {
			a[i]=input.nextInt();
		}

	}

	public static void sort(int x[]) {
		for(int j=0;j<x.length;j++) {
			for(int i=x.length-1;i>0;i--) {
				if(x[i]>x[i-1]) {
					int temp=x[i];
					x[i]=x[i-1];
					x[i-1]=temp;
				}
			}
		}
	}
	public static void main(String args[]) {

		input();
		sort(a);
		if(a[0]>a[1]+a[2]+a[3])System.out.print("NO");
		else if(a[0]==a[1]+a[2]+a[3])System.out.print("YES");
		else if(a[0]<a[1]+a[2]+a[3]) {
			if(a[0]+a[3]>a[1]+a[2])System.out.print("NO");
			else if(a[0]+a[3]<a[1]+a[2])System.out.print("NO");
			else if(a[0]+a[3]==a[1]+a[2])System.out.print("YES");
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Collections;
import java.util.StringTokenizer;

public class Codeforces721A {

	public static void main(String[] args) {
		FastScanner sc=new FastScanner();
		int n = sc.nextInt();
		char[] a = sc.next().toCharArray();
		int i = 0;
		ArrayList<Integer> list = new ArrayList<>();
		while(i < n) {
			int count = 0;
			while(i < n &&  a[i] == 'B') {
				count++;
				i++;
			}
			if(count != 0) {
				list.add(count);
			}i++;
		}
		if(list.isEmpty())System.out.println(0);
		else {
			System.out.println(list.size());
			for(int item : list) {
				System.out.print(item + " ");
			}
		}

	}

	public void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!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());
		}

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

}


/**
 * Created by iainws on 27/06/15.
 */

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

public class KyoyaPhotoBooks {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReaderKyoyaPhotoBooks in = new InputReaderKyoyaPhotoBooks(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskKyoyaPhotoBooks solver = new TaskKyoyaPhotoBooks();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskKyoyaPhotoBooks {
    public void solve(int taskNumber, InputReaderKyoyaPhotoBooks in, PrintWriter out) {
        String s = in.next();
        int cnt = 0;
        for(int i = 0; i <= s.length(); ++i){
            for(int j = 0; j < 26; ++j){
                cnt++;
            }
        }
        System.out.println(cnt - s.length());
    }
}

class InputReaderKyoyaPhotoBooks {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReaderKyoyaPhotoBooks(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());
    }

}


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

public class Solution {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out),8192*8);
		StringTokenizer s;
		SortedSet<Integer> ssx = new TreeSet<Integer>();
		SortedSet<Integer> ssy = new TreeSet<Integer>();
		Iterator itx,ity;
		int x[],y[],t,midx,midy;
		x=new int[8];
		y=new int[8];
		boolean flag,fail=false;
		for(t=0;t<8;t++) {
			s=new StringTokenizer(br.readLine());
			x[t]=Integer.parseInt(s.nextToken());
			ssx.add(x[t]);
			y[t]=Integer.parseInt(s.nextToken());
			ssy.add(y[t]);
			for(int i=t-1;i>=0;i--) {
				if (x[i]==x[t])
					if (y[i]==y[t]) {
						fail=true;
						break;
					}
			}

		}
		if (ssx.size() != 3 || ssy.size() != 3 || fail)
			bw.write("ugly\n");
		else {
			itx=ssx.iterator();
			ity=ssy.iterator();
			itx.next();
			midx=(Integer)itx.next();
			ity.next();
			midy=(Integer)ity.next();
			for (t=0;t<8;t++)
				if (x[t]==midx && y[t]==midy)
					break;
			if (t<8) bw.write("ugly\n");
			else bw.write("respectable\n");
		}
		bw.flush();
	}
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Solution {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out,true);
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int count = 1,people=0;
        st = new StringTokenizer(br.readLine());
        int[] a = new int[n];
        for(int i =0;i<n;i++){
            a[i]  = Integer.parseInt(st.nextToken());
        }
        for(int i =0;i<n;i++){
            if(people+a[i]<=m){
                people+=a[i];
            }
            else{
                count++;
                people= a[i];
            }

        }
        out.println(count);
    }
}


// package Ladder14;

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

public class CF388A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int s = 0;
        for(int i=0;i<n;i++){
            if(s * arr[i] + s <= i){
                s++;
            }
        }
        System.out.println(s);
    }
}


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

public class KSN {

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

	static void input() throws IOException {
		Reader.init(System.in);
		Reader.delimiter = " ";
	}

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub

		input();
		solve();
	}

	static void solve() throws IOException {

		int n = Reader.nextInt();
		int a = Reader.nextInt();

		int ans = 1;

		if (a % 2 != 0)
			ans += (a - 1) / 2;

		else
			ans += (n - a) / 2;

		out.println(ans);
		out.flush();
		out.close();

	}

	static class Reader {

		static BufferedReader reader;
		static StringTokenizer tokenizer;
		static String delimiter = " ";

		static void init(InputStream input) {
			reader = new BufferedReader(new InputStreamReader(input));
			tokenizer = new StringTokenizer(" ");
		}

		static String next() throws IOException {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {

				tokenizer = new StringTokenizer(reader.readLine());
			}
			return tokenizer.nextToken(delimiter);
		}

		static String nextLine() throws IOException {
			return reader.readLine();
		}

		static char nextChar() throws IOException {
			return (char) reader.read();
		}

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

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

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

		static long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}

			return arr;
		}

		static int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

	}

}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;

import static java.util.Comparator.reverseOrder;

public class Solutions {
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC) throws Exception {
        int n = ni();
        int[] coins = new int[]{100, 20, 10, 5, 1};
        int i = 0;
        int res = 0;
        while (i < coins.length){
            while (n >= coins[i]){
                n -= coins[i];
                res++;
            }
            i++;
        }
        p(res);
        p("\n");
    }

    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    final long IINF = (long)1e15;
    final int INF = (int)1e9+2, MX = (int)2e6+5;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = true, memory = false, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //int T = (multipleTC) ? ni() : 1;
        pre();
        //for (int t = 1; t <= T; t++) solve(t);
        solve(0);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis() - ct + "ms");
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Solutions().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Solutions().run();
    }
    int[][] make(int n, int[] from, int[] to, int e, boolean f){
        int[][] g = new int[n][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = to[i];
            if(f)g[to[i]][--cnt[to[i]]] = from[i];
        }
        return g;
    }
    int[][][] makeS(int n, int[] from, int[] to, boolean f){
        int[][][] g = new int[n][][];int[]cnt = new int[n];
        for(int i:from)cnt[i]++;if(f)for(int i:to)cnt[i]++;
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];
        for(int i = 0; i< from.length; i++){
            g[from[i]][--cnt[from[i]]] = new int[]{to[i], i};
            if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i};
        }
        return g;
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

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

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.net.ssl.SSLContext;

public class Main
{
   static long mod=(long)(1e+9) + 7;
   static int[] sieve;static int ans=0;
   static ArrayList<Integer> primes;

   public static double area(int x1, int y1, int x2, int y2,int x3, int y3)
   {
    return Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
   }

public static int ch(square cor[], int x, int y)
{
 int x1 = cor[0].x, y1 = cor[0].y, x2 = cor[1].x, y2 = cor[1].y;
 int x3 = cor[2].x, y3 = cor[2].y, x4 = cor[3].x, y4 = cor[3].y;

 double a = area(x1, y1, x2, y2, x3, y3) + area(x1, y1, x4, y4, x3, y3);

 double p = area(x, y, x1, y1, x2, y2);
 double q = area(x, y, x2, y2, x3, y3);
 double r = area(x, y, x3, y3, x4, y4);
 double s = area(x, y, x1, y1, x4, y4);

 if(a==(p+q+r+s)) return 1;
 return 0;
 }

   static class square
   {
	   int x;int y;
   }

   public static void main(String[] args) throws java.lang.Exception
   {
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);
	     Scanner sc=new Scanner(System.in);
	     StringBuilder final_ans = new StringBuilder();

	     square a[]=new square[4];
	     square b[]=new square[4];

	     for(int i=0;i<4;i++)
	     {
	    	 a[i]=new square();
	    	 a[i].x=s.nextInt();
	    	 a[i].y=s.nextInt();
	     }

	     for(int i=0;i<4;i++)
	     {
	    	 b[i]=new square();
	    	 b[i].x=s.nextInt();
	    	 b[i].y=s.nextInt();
	     }

	     for(int i = -100 ; i <= 100 ; i++)
	     {
	 		for(int j = -100 ; j <= 100 ; j++)
	 		{
	 			if(ch(a, i, j)==1 && ch(b, i, j)==1)
	 			{
	 				System.out.println("YES");
	 				return ;
	 			}
	 		}
	 	 }

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

   static class fast {
		private InputStream i;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;

			   }
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);
			   System.out.println(quotient+" "+remainder);
		   }

		public static void sieve(int size)
		{
			sieve=new int[size+1];
			primes=new ArrayList<Integer>();
			sieve[1]=1;
			for(int i=2;i<=Math.sqrt(size);i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) sieve[j]=1;
				 }
			}

			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}
		public static long pow(long n, int b, long MOD)
		   {
		       long x=1;long y=n;
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD);
		           b >>= 1;
		       }
		       return x;
		   }

		 public static int lower(Integer[] a,int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]<key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]>=key && (((mid-1)>=0 && a[mid-1]<key) || (mid-1)==0)) return mid;
			   else if(a[mid]== key && (mid-1)>=0 && a[mid-1]==key) return lower(a,start,mid-1,key);
			   else if(key>a[mid]) return lower(a,mid+1,end,key);
			   else return lower(a,start,mid-1,key);
		}

		 public static int upper(Integer a[],int start,int end,int key)
		 {
			   int mid=(start+end)>>1;
			   if(start==end && a[mid]>key) {return -1;}
			   if(start>end) return -1;

			   if(a[mid]<=key && (((mid+1)<a.length && a[mid+1]>key) || (mid+1)==a.length)) return mid;
			   else if(a[mid]== key && (mid+1)<a.length && a[mid+1]==key) return upper(a,mid+1,end,key);
			   else if(key>=a[mid]) return upper(a,mid+1,end,key);
			   else return upper(a,start,mid-1,key);
		}

		public int gcd(int a,int b)
		{
			if(a==0) return b;
			return gcd(b%a,a);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.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 nextString() {
     		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 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;
		}

	}
}


import java.util.*;
public class DoubleCola {

	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in) ;
		while (sc.hasNext())
		{
			int n = sc.nextInt() ;
			int m = 5 ;
			int counter = 1 ;
			String s ="" ;
		if (n < 5) {
			if (n == 1) {
				s = "Sheldon" ;
			}else{
				if (n == 2) {
					s = "Leonard" ;
				}else{
					if (n == 3) {
						s = "Penny" ;
					}else{
						if (n == 4) s = "Rajesh" ;
						else{
							s = "Howard " ;
						}
					}
				}
			}
		}else{
			for (int i = 0; n > m*counter; i++) {
				n -= m*counter ;
				//System.out.println(m +" * " + counter + " = " +n);
				counter *= 2 ;
			}
			/**
			if (counter == 2) counter = 1;
			else{
				if (counter != 1) counter -= 2 ;
			//	else counter -- ;
			}
			*/
			int help = 0 ;
			for (int i = 1; n > counter && counter != 0; i++) {
				n -= counter ;
				help = i ;
			}
			if (help == 0) {
				s = "Sheldon" ;
			}else{
				if (help == 1) {
					s = "Leonard" ;
				}else{
					if (help == 2) {
						s = "Penny" ;
					}else{
						if (help == 3 )  s = "Rajesh " ;
						else s = "Howard" ;
					}
				}
			}
			if (counter == 0) s = "Sheldon" ;
		 }
			System.out.println(s);
		}

	}

}


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

public class BetaRound70_C implements Runnable {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws IOException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    @Override
    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            Locale.setDefault(Locale.US);
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    public static void main(String[] args) {
        new Thread(new BetaRound70_C()).start();
    }

    void solve() throws IOException {
        long m = readInt();
        long n = readInt();
        long k = readInt();
        if (m % 2 == 0) {
            out.print("Marsel");
            return;
        }
        if (n == 1) {
            out.print("Marsel");
            return;
        }
//      boolean[] p = new boolean[1000*100+1];
//      Arrays.fill(p, true);
//      p[0]=p[1]=false;
//      for (long i = 2; i <= 1000*100; i++) {
//          if (p[(int)i]) {
//              for (long j = i*i; j <= 1000*100; j+=i) {
//                  p[(int)j] = false;
//              }
//          }
//      }

        boolean prime = true;
        for (int i = 2; i*i <= n; i++) {
            if (n%i==0) {
                if (n/i < k) {
                    out.print("Marsel");
                    return;
                }
                prime = false;
                break;
            }
        }

        if (prime) {
            if (k == 1) {
                out.print("Timur");
                return;
            } else {
                out.print("Marsel");
                return;
            }
        }

        out.print("Timur");
//      if (n % 2 == 0) {
//          out.print("Timur");
//          return;
//      } else {
//          out.print("Marsel");
//          return;
//      }
    }

}


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

public class Main {

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

		int a = sc.nextInt(), b = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int Tx = 0, Ty = 0;
		for(char c: s)
			if(c == 'U')
				++Ty;
			else if(c == 'D')
				--Ty;
			else if(c == 'R')
				++Tx;
			else
				--Tx;
		int px = 0, py = 0;
		boolean yes = check(a, b, Tx, Ty, px, py);
		for(char c: s)
		{
			if(c == 'U')
				++py;
			else if(c == 'D')
				--py;
			else if(c == 'R')
				++px;
			else
				--px;
			yes |= check(a, b, Tx, Ty, px, py);
		}
		out.println(yes ? "Yes" : "No");
		out.flush();
		out.close();
	}

	static boolean check(int a, int b, int tx, int ty, int px, int py)
	{
		int lx = check(a - px, tx), ly = check(b - py, ty);
		if(lx == -2 || ly == -2)
			return false;
		return  lx == -1 || ly == -1 || lx == ly;
	}

	static int check(int c, int t)
	{
		if(t == 0)
			return c == 0 ? -1 : -2;
		return 1l * c * t >= 0 && c % t == 0 ? c / t : -2;
	}

	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 { return Double.parseDouble(next()); }

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


/*
 * Author- Naitik Dodia
 * BTech 3rd Year DAIICT
 */

import java.io.*;

import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;

public class Solution {
	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	private static long count = 0,mod=1000000007;
	private static TreeSet<Integer>ts[]=new TreeSet[200000];

	public static void main(String args[]) throws Exception {
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		soln();
		pw.close();
	}
	private static boolean visited[];
	private static int par[];
	private static LinkedList<Integer>[] adj;
	private static void dfs(int start,int root) {
		visited[start]=true;
		par[start]=root;
		for(int i:adj[start]) {
			if(!visited[i]) {
				dfs(i,start);
			}
		}
	}
	private static void soln(){
		int a=nextInt(),b=nextInt(),x=nextInt(),y=nextInt(),z=nextInt();
		long ans=0;
		if((long)a<2*(long)x) {
			ans+=2*(long)x-a;
			a=0;
			//pw.println("1 "+ans);
		}else {
			a=a-2*x;
		}
		if((long)b<3*(long)z) {
			ans+=3*(long)z-b;
			b=0;
			//pw.println("2 "+ans);
		}else {
			b=b-3*z;
		}
		if(a<b) {
			y=y-a>0?y-a:0;
			b=b-a;
			a=0;
		}else {
			y=y-b>0?y-b:0;
			b=a-b;
			a=0;
		}
		if(y>b) {
			ans+=b+2*(y-b);
			//pw.println("3 "+ans);
		}else{
			ans+=y;
			//pw.println(ans);
		}
		pw.println(ans);
	}

	public static int bfsPair(int[][] arr,boolean[][] visited,int x1,int y1,int x2,int y2) {
		Queue<Pair> q=new LinkedList<Pair>();
		visited[x1][y1]=true;
		int level = 1;
		int increamenter=0;
		if(x1-1>=0)
		if(arr[x1-1][y1]==1) increamenter++;
		if(y1-1>=0)
		if(arr[x1][y1-1]==1) increamenter++;
		if(y1+1<arr[1].length)
		if(arr[x1][y1+1]==1) increamenter++;
		if(x1+1<arr.length)
		if(arr[x1+1][y1]==1) increamenter++;

		q.add(new Pair(x1,y1));
		int i=0;
		while(!q.isEmpty()) {
			Pair p=q.poll();
			//increamenter--;
			int x=p.idx,y=p.val;
			if(x-1>=0 && y>=0 && x-1<arr.length && y<arr[1].length) {
				if(!visited[x-1][y] && arr[x-1][y]==1)
				q.add(new Pair(x-1,y));
				visited[x-1][y]=true;
			}
			if(x>=0 && y-1>=0 && x<arr.length && y-1<arr[1].length) {
				if(!visited[x][y-1] && arr[x][y-1]==1)
				q.add(new Pair(x,y-1));
				visited[x][y-1]=true;
			}
			if(x>=0 && y+1>=0 && x<arr.length && y+1<arr[1].length) {
				if(!visited[x][y+1] && arr[x][y+1]==1)
				q.add(new Pair(x,y+1));
				visited[x][y+1]=true;
			}
			if(x+1>=0 && y>=0 && x+1<arr.length && y<arr[1].length) {
				if(!visited[x+1][y] && arr[x+1][y]==1)
				q.add(new Pair(x+1,y));
				visited[x+1][y]=true;
			}
			if(x==x2 && y==y2) return level;//pw.println(x+" "+y+" "+level+" "+increamenter);
			if(increamenter==0) {
				level++;
				increamenter=q.size();

			}
			increamenter--;
		}
		return -1;
	}

	public static void bfs(ArrayList<Integer>[] gp, int s,boolean[] visited,int[] dist){
		Queue<Integer> qu=new LinkedList<Integer>();
		int level = 1;
		int increamenter;
		if(gp[s]!=null)
		increamenter=gp[s].size()+1;
		else return;
		visited[s]=true;
		qu.add(s);
		while(!qu.isEmpty()){
			int temp=qu.poll();
			//visited[temp]=true;
			increamenter--;
			dist[temp]=level*6;
			for(int i=0;i<gp[temp].size();i++){
				if(!visited[gp[temp].get(i)]){
					//increamenter--;
					//pw.println(increamenter);
					visited[gp[temp].get(i)]=true;
					qu.add(gp[temp].get(i));
					//dist[gp[temp].get(i)]=level*6;
				}
			}
			if(increamenter==0){
				level++;
				increamenter=qu.size();
				//pw.println("increamenter change at: "+qu.size()+"with level"+level);
			}

		}
	}
	static int maxSubArraySum(int a[])
    {
        int size = a.length;
        int max_so_far = Integer.MIN_VALUE, max_ending_here = 0;

        for (int i = 0; i < size; i++)
        {
            max_ending_here = max_ending_here + a[i];
            if (max_so_far < max_ending_here)
                max_so_far = max_ending_here;
            if (max_ending_here < 0)
                max_ending_here = 0;
        }
        return max_so_far;
    }
	public static ArrayList<Integer> allprime(int n){
		ArrayList<Integer> arr=new ArrayList<Integer>();
		arr.add(2);
		for(int i=3;i<n;i=i+2){
			int flag=0;
			for(int j=0;j<arr.size();j++){
				if(i%arr.get(j)==0) {flag=1;break;}
			}
			if(flag==0) arr.add(i);
		}
		return arr;
	}
	public static int fact(int n){
		int ans=1;
		for(int i=1;i<=n;i++) ans=(ans*i)%1000000007;
		return ans;
	}
	static class Pair implements Comparable<Pair>{

		int idx,val;
		Pair(int idx,int val){
			this.idx=idx;
			this.val=val;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
		//	Sort in increasing order

			if(o.val<val){
				return 1;
			}
			if(o.val==val){
				return 0;
			}
			else{
				return -1;
			}
		}
		@Override
		public String toString(){
			return "idx: "+Integer.toString(idx)+" val: "+Integer.toString(val);
		}
	}
	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}
	private static int BinarySearch(int a[], int low, int high, int target) {
		if (low > high)
			return -1;
		int mid = low + (high - low) / 2;
		if (a[mid] == target)
			return mid;
		if (a[mid] > target)
			high = mid - 1;
		if (a[mid] < target)
			low = mid + 1;
		return BinarySearch(a, low, high, target);
	}

	public static String reverseString(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return (sb.toString());
	}
	public static long pow(long n, long p, long m) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}
	public static long pow(long n, long p) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			p >>= 1;
			n *= n;
		}
		return result;
	}
	public static int[] radixSort(int[] f) {
		int[] to = new int[f.length];
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] & 0xffff)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] & 0xffff]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] >>> 16)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] >>> 16]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		return f;
	}
	public static int nextPowerOf2(final int a) {
		int b = 1;
		while (b < a) {
			b = b << 1;
		}
		return b;
	}
	public static boolean PointInTriangle(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {
		int s = p2 * p5 - p1 * p6 + (p6 - p2) * p7 + (p1 - p5) * p8;
		int t = p1 * p4 - p2 * p3 + (p2 - p4) * p7 + (p3 - p1) * p8;

		if ((s < 0) != (t < 0))
			return false;

		int A = -p4 * p5 + p2 * (p5 - p3) + p1 * (p4 - p6) + p3 * p6;
		if (A < 0.0) {
			s = -s;
			t = -t;
			A = -A;
		}
		return s > 0 && t > 0 && (s + t) <= A;
	}
	public static float area(int x1, int y1, int x2, int y2, int x3, int y3) {
		return (float) Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
	}

	public static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}

	//merge Sort

	static long sort(int a[])
	{  int n=a.length;
		int b[]=new int[n];
		return mergeSort(a,b,0,n-1);}
	static long mergeSort(int a[],int b[],long left,long right)
	{ long c=0;if(left<right)
	 {   long mid=left+(right-left)/2;
		 c= mergeSort(a,b,left,mid);
		 c+=mergeSort(a,b,mid+1,right);
		 c+=merge(a,b,left,mid+1,right); }
		return c;	 }
	static long merge(int a[],int  b[],long left,long mid,long right)
	{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
	while(i<=(int)mid-1&&j<=(int)right)
	{ if(a[i]>a[j]) {b[k++]=a[i++]; }
	else	{ b[k++]=a[j++];c+=mid-i;}}
	while (i <= (int)mid - 1)   b[k++] = a[i++];
	while (j <= (int)right) b[k++] = a[j++];
	for (i=(int)left; i <= (int)right; i++)
		a[i] = b[i];  return c;  }

	// To Get Input
	// Some Buffer Methods

	public static void InputReader(InputStream stream1) {
		stream = stream1;
	}

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

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

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

	private static 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;
	}

	private static 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;
	}

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

	private static 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();
	}

	private static int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}

	private static int[][] next2dArray(int n, int m) {
		int[][] arr = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				arr[i][j] = nextInt();
			}
		}
		return arr;
	}

	private static long[] nextLongArray(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		return arr;
	}

	private static void pArray(int[] arr) {
		for (int i = 0; i < arr.length; i++) {
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

	private static void pArray(long[] arr) {
		for (int i = 0; i < arr.length; i++) {
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

	private static void pArray(boolean[] arr) {
		for (int i = 0; i < arr.length; i++) {
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

	private static boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

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


import java.util.Scanner;

public class File1{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int x1 = in.nextInt();
		int y1 = in.nextInt();
		int x2 = in.nextInt();
		int y2 = in.nextInt();
		if(x1==0&&x2==0)
			System.out.println(Math.abs(y2-y1));
		else if(x1==0&&x2==n)
			System.out.println(n+Math.min(y1+y2,2*n-y1-y2));
		else if(x1==0&&y2==0)
			System.out.println(y1+x2);
		else if(x1==0&&y2==n)
			System.out.println(n-y1+x2);
		else if(x1==n&&x2==n)
			System.out.println(Math.abs(y2-y1));
		else if(x1==n&&x2==0)
			System.out.println(n+Math.min(y1+y2, 2*n-y1-y2));
		else if(x1==n&&y2==0)
			System.out.println(n-x2+y1);
		else if(x1==n&&y2==n)
			System.out.println(2*n-y1-x2);
		else if(y1==0&&y2==0)
			System.out.println(Math.abs(x2-x1));
		else if(y1==0&&y2==n)
			System.out.println(n+Math.min(x1+x2,2*n-x1-x2));
		else if(y1==0&&x2==0)
			System.out.println(y2+x1);
		else if(y1==0&&x2==n)
			System.out.println(n-x1+y2);
		else if(x2==0)
			System.out.println(n-y2+x1);
		else if(x2==n)
			System.out.println(2*n-y2-x1);
		else if(y2==n)
			System.out.println(Math.abs(x2-x1));
		else System.out.println(n+Math.min(2*n-x1-x2,x1+x2));
	}
}


import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class A {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        char[] a = sc.next().toCharArray();
        List<Character> list = new ArrayList<>();
        for (char c : a) list.add(c);
        while (true) {
            int max = 0, maxIdx = -1;
            for (int i = 0; i < list.size(); i++) {
                if ((i > 0 && list.get(i) == list.get(i - 1) + 1 || i < list.size() - 1 && list.get(i) == list.get(i + 1) + 1) && list.get(i) > max) {
                    max = list.get(i);
                    maxIdx = i;
                }
            }
            if (maxIdx == -1) break;
            List<Character> newList = new ArrayList<>();
            for (int i = 0; i < list.size(); i++) {
                if (i != maxIdx) {
                    newList.add(list.get(i));
                }
            }
            list = newList;
        }
        out.println(a.length - list.size());
        out.flush();
        out.close();
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {br = new BufferedReader(new InputStreamReader(system));}
        public Scanner(String file) throws Exception {br = new BufferedReader(new FileReader(file));}
        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public String nextLine()throws IOException{return br.readLine();}
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        public double nextDouble() throws IOException {return Double.parseDouble(next());}
        public char nextChar()throws IOException{return next().charAt(0);}
        public Long nextLong()throws IOException{return Long.parseLong(next());}
        public boolean ready() throws IOException{return br.ready();}
        public void waitForInput() throws InterruptedException {Thread.sleep(3000);}
    }
}


import java .util.Scanner ;
import java.util.*;
import java.math.BigInteger;
import java.nio.IntBuffer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
//import java.io.OutputStreamReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.lang.Math;
import java.util.Arrays;
import java.util.Collections;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;

public class cf2{
    public static void main(final String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);

        int n =in.nextInt();
        if(n>=0){
            System.out.println(n);
        }
        else {
            int lastd=n%10;
            if(lastd==0){
                String str =Integer.toString(n);
                int m=str.length();
                str=str.substring(0, m-2)+str.substring(m-1);
                int a=Integer.parseInt(str);
                System.out.println(a);
            }
            else {
                String str=Integer.toString(n);
                int m=str.length();
                String x=str.substring(m-2,m-1);
                int g=Integer.parseInt(x);
                String y=str.substring(m-1);
                int h=Integer.parseInt(y);

                if(g<h){
                    str=str.substring(0, m-1);
                    System.out.println(str);
                }
                else{
                    str=str.substring(0,m-2)+str.substring(m-1);
                    System.out.println(str);
                }
            }
        }
    }
}

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

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

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

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

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

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

    public int nextInt() {
        int c = read();

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

        int sgn = 1;

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

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

        return res * sgn;
    }

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

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

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

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

        return res.toString();
    }

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

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

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


//package yahia;
import java.util.*;
public class lm {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();ArrayList<Integer>x=new ArrayList<>();for (int i=0;i<n;++i)x.add(sc.nextInt());Collections.sort(x);ArrayList<Integer>x2=new ArrayList<>();
		if (n==1) {System.out.println(0);return;}
		if (x.size()==2) {if((x.get(1)-x.get(0))%2==0)System.out.println((x.get(1)-x.get(0))/2);else System.out.println((x.get(1)-x.get(0)));return;}
		boolean f=true;
		Set<Integer> x1 = new HashSet<>(x);
		x.clear();
		x.addAll(x1);
		//System.out.println(x1);
		for (int i:x1) {
			x2.add(i);
		}
		Collections.sort(x2);
		if (x1.size()==1) {System.out.println(0);return;}
		if (x1.size()>3) {System.out.println(-1);return;}
		if (x1.size()==2) {if((x2.get(1)-x2.get(0))%2==0)System.out.println((x2.get(1)-x2.get(0))/2);else System.out.println((x2.get(1)-x2.get(0)));return;}
		if (x2.get(1)-x2.get(0)==x2.get(2)-x2.get(1))System.out.println(x2.get(2)-x2.get(1));else System.out.println(-1);
	}
}


import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int a1 = kb.nextInt();
		int b1 = kb.nextInt();
		int c1 = kb.nextInt();
		int a2 = kb.nextInt();
		int b2 = kb.nextInt();
		int c2 = kb.nextInt();
		int D = a1*b2-a2*b1;
		if((a1==0&&b1==0&&c1!=0)||(a2==0&&b2==0&&c2!=0))System.out.println(0);
		else if((a1==0&&b1==0&&c1==0)||(a2==0&&b2==0&&c2==0))System.out.println(-1);
		else if(D!=0)System.out.println(1);
		else if(a1*c2==a2*c1&&b1*c2==b2*c1)System.out.println(-1);
		else System.out.println(0);
	}
}


//Author-Vishal Burman

import java.io.*;
import java.util.*;
public class testClass_codeforces{
    public static void main(String[] args) throws IOException {
        Reader sc = new Reader();
        PrintWriter out = new PrintWriter(System.out, true);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<String> list=new ArrayList<>();
        int flag=0;
        String str0="WBWBWBWB";
        String str1="BWBWBWBW";
        for(int i=0;i<8;i++){
            String str=br.readLine();
            if(i%2==0){
                if(str.equals(str0))
                    flag=0;
                else{
                    if(alternate(str))
                        flag=0;
                    else{
                        flag=1;
                        break;
                    }
                }
            }
            else{
                if(str.equals(str1))
                    flag=0;
                else{
                    if(alternate(str))
                        flag=0;
                    else{
                        flag=1;
                        break;
                    }
                }
            }
        }
        if(flag==0)
            out.println("YES");
        else
            out.println("NO");
        out.flush();
    }
    public static boolean alternate(String x){
        int flag=0;
        char let1=x.charAt(0);
        for(int i=1;i<x.length();i++){
            if(x.charAt(i)!=x.charAt(i-1))
                continue;
            else
                return false;
        }
        return true;
    }
}
class Reader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException {
        byte[] buf = new byte[256]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1) {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

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

    public double nextDouble() throws IOException {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.') {
            while ((c = read()) >= '0' && c <= '9') {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

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

    private byte read() throws IOException {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException {
        if (din == null)
            return;
        din.close();
    }
}


import java.util.Scanner;

public class Mohsen{
    public static void main(String[] args){
        Scanner  console = new Scanner(System.in);
        long n = console.nextLong(), m=console.nextLong(), a=console.nextLong(), b=console.nextLong();
        System.out.println(Math.min((n % m)*b, (m - (n % m))*a));
    }
}


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

/**
 * Created by peacefrog on 11/9/15.
 * Time : 10:22 PM
 */

public class TavasAndSaDDas299B {
	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	PrintWriter out;
	long timeBegin, timeEnd;

	public void runIO() throws IOException {
		timeBegin = System.currentTimeMillis();

		InputStream inputStream;
		OutputStream outputStream;

		if (ONLINE_JUDGE) {
			inputStream = System.in;
			Reader.init(inputStream);
			outputStream = System.out;

			out = new PrintWriter(outputStream);

		} else {
			inputStream = new FileInputStream("/home/peacefrog/Dropbox/IdeaProjects/Problem Solving/input");
			Reader.init(inputStream);
			out = new PrintWriter("output.txt");
		}

		solve();

		out.flush();
		out.close();
		timeEnd = System.currentTimeMillis();

		System.err.println("Time = " + (timeEnd - timeBegin));

	}

	/*
	 * Start Solution Here
	 */

	private void solve() throws IOException {
		long n = Reader.nextLong(); //This Variable default in Code Templete
		ArrayList<Long> lucky = new ArrayList<>();

		ArrayList<Long> temp = new ArrayList<>();

		temp.add(4L);
		temp.add(7L);

		while (!temp.isEmpty())
		{
			long top = temp.remove(0);
			if (top <= 1E9)
			{
				lucky.add(top);
				temp.add(top*10+4);
				temp.add(top*10+7);
			}
		}

		Collections.sort(lucky);
		System.out.println(lucky.indexOf(n)+1);
	}

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

		new TavasAndSaDDas299B().runIO();
	}

	static class Reader {
		static BufferedReader reader;
		static StringTokenizer tokenizer;

		/**
		 * call this method to initialize reader for InputStream
		 */
		static void init(InputStream input) {
			reader = new BufferedReader(new InputStreamReader(input));
			tokenizer = new StringTokenizer("");
		}

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

		static String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "";
		}

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

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

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

}