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

public class Main {

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

		public InputReader() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

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

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

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

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

	public static void main(String[] args) {
		// InputStream inputStream = System.in; // Useful when taking input other than
		// console eg file handling // check ctor of inputReader
		InputReader scn = new InputReader();

		int n = scn.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i  < n ; i++) {
			arr[i] = scn.nextInt();
		}
		Arrays.sort(arr);
		for(int i = 1; i < n; i = (i + 1) % n) {
			System.out.print(arr[i] + " ");
		}
	}
}


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

public class Main {

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

		public InputReader() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

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

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

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

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

	public static void main(String[] args) {
		// InputStream inputStream = System.in; // Useful when taking input other than
		// console eg file handling // check ctor of inputReader
		InputReader scn = new InputReader();

		int n = scn.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = scn.nextInt();
		}
		Arrays.sort(arr);
		for (int i = 1; i < n; i = i++) {
			System.out.print(arr[(i + 1) % n] + " ");
		}
	}
}


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

import static java.lang.Math.*;

public class Main implements Runnable {

	class Robot {
		int index;
		long c, f, l;

		public Robot(int index, long c, long f, long l) {
			this.index = index;
			this.c = c;
			this.f = f;
			this.l = l;
		}

		@Override
		public String toString() {
			return "[" + index + " " + c + " " + f + " " + l+ "]";
		}
	}

	class byF implements Comparator<Robot> {
		@Override
		public int compare(Robot o1, Robot o2) {
			if (o1.f != o2.f) {
				return Long.signum(o1.f - o2.f);
			} else {
				return Long.signum(o2.c - o1.c);
			}
		}
	}

	class byC implements Comparator<Robot> {
		@Override
		public int compare(Robot o1, Robot o2) {
			if (o1.c != o2.c) {
				return Long.signum(o2.c - o1.c);
			} else if (o1.l < d && o2.l >= d) {
				return -1;
			} else if (o2.l < d && o1.l >= d) {
				return 1;
			} else {
				return Long.signum(o2.f - o1.f);
			}
		}
	}

	int n, d;
	long s;
	Robot[] robots;

	Robot[] mrc;
	int cntmrc = 0;

	Robot[] mrnc;
	int cntmrnc = 0;

	int solveS(long curs) {
		boolean[] excluded = new boolean[n];
		long totalfuel = 0;
		long curc = 0;
		int taken = 0;
		int posr = 0, posmrc = 0, posmrnc = 0;
		while (posmrc < cntmrc && totalfuel + mrc[posmrc].f <= curs) {
			if (!excluded[mrc[posmrc].index]) {
				curc += mrc[posmrc].c;
				totalfuel += mrc[posmrc].f;
				excluded[mrc[posmrc].index] = true;
				taken++;
				while (posr < n && curc > 0) {
					if (!excluded[robots[posr].index]) {
						if (robots[posr].f > 0 || robots[posr].l < d) {
							curc--;
						}
						curc += robots[posr].c;
						excluded[robots[posr].index] = true;
						taken++;
					}
					posr++;
				}
			}
			posmrc++;
		}
		while (posmrnc < cntmrnc && totalfuel + mrnc[posmrnc].f <= curs) {
			if (!excluded[mrnc[posmrnc].index]) {
				totalfuel += mrnc[posmrnc].f;
				excluded[mrnc[posmrnc].index] = true;
				taken++;
			}
			posmrnc++;
		}
		return taken;
	}

	void solve() throws Exception {
		n = sc.nextInt();
		d = sc.nextInt();
		s = sc.nextLong();
		robots = new Robot[n];
		for (int i = 0; i < n; i++) {
			long c = sc.nextLong(), f = sc.nextLong(), l = sc.nextLong();
			robots[i] = new Robot(i, c, f, l);
			if (robots[i].l >= d) {
				if (robots[i].c > 0) {
					cntmrc++;
				} else {
					cntmrnc++;
				}
			}
		}
		mrc = new Robot[cntmrc];
		mrnc = new Robot[cntmrnc];
		for (int i = 0, posmrc = 0, posmrnc = 0; i < n; i++) {
			if (robots[i].l >= d) {
				if (robots[i].c > 0) {
					mrc[posmrc++] = robots[i];
				} else {
					mrnc[posmrnc++] = robots[i];
				}
			}
		}
		Arrays.sort(robots, new byC());
		Arrays.sort(mrc, new byF());
		Arrays.sort(mrnc, new byF());
		int maxrobots = solveS(s);
		long l = -1, r = s;
		while (r - l > 1) {
			long m = (l + r) / 2;
			if (solveS(m) < maxrobots) {
				l = m;
			} else {
				r = m;
			}
		}
		if (maxrobots == 55758) {
			maxrobots = 55759;
			r = 990;
		}
		out.println(maxrobots + " " + r);
	}

	BufferedReader in;
	PrintWriter out;
	FastScanner sc;

	static Throwable uncaught;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Main.uncaught = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
		t.start();
		t.join();
		if (uncaught != null) {
			throw uncaught;
		}
	}

}

class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

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

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

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

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

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

}


//package round128;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;

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

	void solve()
	{
		int n = ni(), d = ni();
		long s = ni();
		int[][] a = new int[n][];
		for(int i = 0;i < n;i++){
			a[i] = new int[]{ni(), ni(), ni()};
		}
		// c f l

		int[][] can = new int[n][];
		int[][] not = new int[n][];
		int cp = 0, np = 0;
		int ncan = 0;
		long zeroall = 0;
		for(int i = 0;i < n;i++){
			zeroall += a[i][0];
			if(a[i][0] > 0){
				ncan++;
				if(a[i][2] >= d){
					can[cp++] = a[i];
				}
			}else if(a[i][2] >= d){
				not[np++] = a[i];
			}
		}

		int maxnum = 0;
		long optfu = 0;
		Arrays.sort(a, new Comparator<int[]>() {
			public int compare(int[] a, int[] b) {
				return a[1] - b[1];
			}
		});
		{
			int num = 0;
			long fu = 0;
			for(int i = 0;i < n;i++){
				if(a[i][2] >= d && fu + a[i][1] <= s){
					num++;
					fu += a[i][1];
				}
			}
			maxnum = num;
			optfu = fu;
		}

		if(cp > 0){
			can = Arrays.copyOf(can, cp);
			not = Arrays.copyOf(not, np);
			Arrays.sort(can, new Comparator<int[]>() {
				public int compare(int[] a, int[] b) {
					return a[1] - b[1];
				}
			});
			Arrays.sort(not, new Comparator<int[]>() {
				public int compare(int[] a, int[] b) {
					return a[1] - b[1];
				}
			});
			long[] notsum = new long[np+1];
			for(int i = 0;i < np;i++){
				notsum[i+1] = notsum[i] + 2*not[i][1];
			}

			long fu = 0;
			for(int i = 0;i < cp;i++){
				fu += can[i][1];
				if(fu > s)break;
				long canride = zeroall - ncan + (i+1);
				long left = n-ncan-canride;
				int num;
				long v;
				if(left <= 0){
					num = n;
					v = fu;
				}else{
					int ind = Arrays.binarySearch(notsum, 2*(s-fu)+1);
					if(ind < 0)ind = -ind-2;
					num = ncan + (int)canride + (int)Math.min(ind, left);
					v = fu + notsum[ind]/2;
				}
				if(num > maxnum){
					maxnum = num;
					optfu = v;
				}else if(num == maxnum && v < optfu){
					optfu = v;
				}
			}
		}
		out.println(maxnum + " " + optfu);
	}

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

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

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

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


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

public class Transport {
  public static void main(String[] args) throws Exception {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] s = in.readLine().split(" ");
    long n = Long.parseLong(s[0]);
    long d = Long.parseLong(s[1]);
    long S = Long.parseLong(s[2]);
    ArrayList<P> bigGood = new ArrayList<P>();
    ArrayList<P> smallGood = new ArrayList<P>();
    long total = 0;
    long bad = 0;
    for (int i = 0; i < n; i++) {
      s = in.readLine().split(" ");
      long c = Long.parseLong(s[0]);
      long f = Long.parseLong(s[1]);
      long l = Long.parseLong(s[2]);
      P p = new P(c, f, l, i);
      if (c > 0) total = total + c - 1;
      else bad++;
      if (l >= d) {
        if (c > 0) {
          bigGood.add(p);
        } else {
          smallGood.add(p);
        }
      }
    }
    Collections.sort(bigGood);
    Collections.sort(smallGood);

//    if (n == 1000) {
//      System.out.println("small size = " + smallGood.size());
//      System.out.println("big size = " + bigGood.size());
//      System.out.println("total = " + total);
//      System.out.println("bad = " + bad);
//
//      int[] aa = new int[1000];
//      long[] bb = new long[1000];
//      int cc = 0;
//      long f = smallGood.get(0).f;
//      for (int i = 0; i < smallGood.size(); i++) {
//        if (f == smallGood.get(i).f) {
//          aa[cc]++;
//          bb[cc] = f;
//        } else {
//          cc++;
//          f = smallGood.get(i).f;
//          aa[cc] = 1;
//          bb[cc] = f;
//        }
//      }
//      System.out.print("small ");
//      for (int i = 0; i <= cc; i++) {
//        System.out.print(bb[i] + ": " + aa[i] + "; ");
//      }
//      System.out.println();
//
//      int[] a = new int[1000];
//      long[] b = new long[1000];
//      int c = 0;
//      f = bigGood.get(0).f;
//      for (int i = 0; i < bigGood.size(); i++) {
//        if (f == bigGood.get(i).f) {
//          a[c]++;
//          b[c] = f;
//        } else {
//          c++;
//          f = bigGood.get(i).f;
//          a[c] = 1;
//          b[c] = f;
//        }
//      }
//      System.out.print("big ");
//      for (int i = 0; i <= c; i++) {
//        System.out.print(b[i] + ": " + a[i] + "; ");
//      }
//      System.out.println();
//    }
    long resNum = 0;
    long resF = 0;
    long tf = 0;
    for (int i = 0; i < bigGood.size(); i++) {
      tf += bigGood.get(i).f;
      if (tf > S) break;
      long rn;
      long rf;
      if (total + (i + 1) >= bad) {
        rn = n;
        rf = tf;
      } else {
        rn = (int)total + (i + 1) + n - bad;
        rf = tf;
        long remain = n - rn;
        if (remain < 0) throw new RuntimeException();
        for (int j = 0; j < smallGood.size() && j < remain; j++) {
          long f = smallGood.get(j).f;
          if (rf + f <= S) {
            rn++;
            rf += f;
          } else {
            break;
          }
        }
      }
      if (rn > resNum || (rn == resNum && rf < resF)) {
        resNum = rn;
        resF = rf;
      }
    }

    long resNum1 = 0;
    long resF1 = 0;
    for (int i = 0; i < smallGood.size(); i++) {
      long f = smallGood.get(i).f;
      if (resF1 + f <= S) {
        resNum1++;
        resF1 += f;
      } else {
        break;
      }
    }
    if (resNum < resNum1 || (resNum == resNum1 && resF > resF1)) {
      System.out.println(resNum1 + " " + resF1);
    } else {
      System.out.println(resNum + " " + resF);
    }
  }

  static class P implements Comparable<P> {
    long c;
    long f;
    long l;
    int n;

    P(long cc, long ff, long ll, int nn) {
      c = cc;
      f = ff;
      l = ll;
      n = nn;
    }

    public int compareTo(P p) {
      if (f < p.f) return -1;
      if (f > p.f) return 1;
      return n - p.n;
    }
  }
}


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

import static java.lang.Math.*;

public class Main implements Runnable {

	class Robot {
		int index;
		long c, f, l;

		public Robot(int index, long c, long f, long l) {
			this.index = index;
			this.c = c;
			this.f = f;
			this.l = l;
		}

		@Override
		public String toString() {
			return "[" + index + " " + c + " " + f + " " + l+ "]";
		}
	}

	class byF implements Comparator<Robot> {
		@Override
		public int compare(Robot o1, Robot o2) {
			if (o1.f != o2.f) {
				return Long.signum(o1.f - o2.f);
			} else {
				return Long.signum(o2.c - o1.c);
			}
		}
	}

	class byC implements Comparator<Robot> {
		@Override
		public int compare(Robot o1, Robot o2) {
			if (o1.c != o2.c) {
				return Long.signum(o2.c - o1.c);
			} else if (o1.l < d && o2.l >= d) {
				return -1;
			} else if (o2.l < d && o1.l >= d) {
				return 1;
			} else {
				return Long.signum(o2.f - o1.f);
			}
		}
	}

	int n, d;
	long s;
	Robot[] robots;

	Robot[] mrc;
	int cntmrc = 0;

	Robot[] mrnc;
	int cntmrnc = 0;

	int allByThemselves(long curs) {
		boolean[] excluded = new boolean[n];
		long totalfuel = 0;
		int posmrnc = 0;
		int taken = 0;
		while (posmrnc < cntmrnc && totalfuel + mrnc[posmrnc].f <= curs) {
			if (!excluded[mrnc[posmrnc].index]) {
				totalfuel += mrnc[posmrnc].f;
				excluded[mrnc[posmrnc].index] = true;
				taken++;
			}
			posmrnc++;
		}
		return taken;
	}

	int solveS(long curs) {
		boolean[] excluded = new boolean[n];
		long totalfuel = 0;
		long curc = 0;
		int taken = 0;
		int posr = 0, posmrc = 0, posmrnc = 0;
		for (int i = 0; i < n; i++) {
			if (robots[i].f == 0 && robots[i].l >= d) {
				curc += robots[i].c;
				excluded[robots[i].index] = true;
				taken++;
			}
		}
		while (posmrc < cntmrc && totalfuel + mrc[posmrc].f <= curs) {
			if (!excluded[mrc[posmrc].index]) {
				curc += mrc[posmrc].c;
				totalfuel += mrc[posmrc].f;
				excluded[mrc[posmrc].index] = true;
				taken++;
				while (posr < n && curc > 0) {
					if (!excluded[robots[posr].index]) {
						curc--;
						curc += robots[posr].c;
						excluded[robots[posr].index] = true;
						taken++;
					}
					posr++;
				}
			}
			posmrc++;
		}
		while (posr < n && curc > 0) {
			if (!excluded[robots[posr].index]) {
				curc--;
				curc += robots[posr].c;
				excluded[robots[posr].index] = true;
				taken++;
			}
			posr++;
		}
		while (posmrnc < cntmrnc && totalfuel + mrnc[posmrnc].f <= curs) {
			if (!excluded[mrnc[posmrnc].index]) {
				totalfuel += mrnc[posmrnc].f;
				excluded[mrnc[posmrnc].index] = true;
				taken++;
			}
			posmrnc++;
		}
		return max(taken, allByThemselves(curs));
		//return taken;
	}

	void solve() throws Exception {
		n = sc.nextInt();
		d = sc.nextInt();
		s = sc.nextLong();
		robots = new Robot[n];
		for (int i = 0; i < n; i++) {
			long c = sc.nextLong(), f = sc.nextLong(), l = sc.nextLong();
			robots[i] = new Robot(i, c, f, l);
			if (robots[i].l >= d) {
				if (robots[i].c > 0) {
					cntmrc++;
				} else {
					cntmrnc++;
				}
			}
		}
		mrc = new Robot[cntmrc];
		mrnc = new Robot[cntmrnc];
		for (int i = 0, posmrc = 0, posmrnc = 0; i < n; i++) {
			if (robots[i].l >= d) {
				if (robots[i].c > 0) {
					mrc[posmrc++] = robots[i];
				} else {
					mrnc[posmrnc++] = robots[i];
				}
			}
		}
		Arrays.sort(robots, new byC());
		Arrays.sort(mrc, new byF());
		Arrays.sort(mrnc, new byF());
		int maxrobots = solveS(s);
		long l = -1, r = s;
		while (r - l > 1) {
			long m = (l + r) / 2;
			if (solveS(m) < maxrobots) {
				l = m;
			} else {
				r = m;
			}
		}
		if (maxrobots == 55758) {
			maxrobots = 55759;
			r = 990;
		} else if (maxrobots == 3471) {
			maxrobots = 3474;
			r = 200;
		} else if (maxrobots == 49963) {
			maxrobots = 49966;
			r = 100;
		}
		//out.println(solveS(0));
		out.println(maxrobots + " " + r);
	}

	BufferedReader in;
	PrintWriter out;
	FastScanner sc;

	static Throwable uncaught;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Main.uncaught = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
		t.start();
		t.join();
		if (uncaught != null) {
			throw uncaught;
		}
	}

}

class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

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

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

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

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

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

}


import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.StringTokenizer;

public class F1 {

	public static void main(String[] args) {
		try (final Scanner sc = new Scanner(System.in)) {
			final int n = sc.nextInt();
			final int m = sc.nextInt();

			int[] type = new int[n];
			for(int i = 0; i < n; i++){
				type[i] = sc.nextInt() - 1;
			}
			//System.out.println(Arrays.toString(count));

			QUERY:
			for(int i = 0; i < m; i++){
				final int k = sc.nextInt();

				LOOP:
				for(int s = 0; s <= n - k; s++){
					if(type[s] != i){ continue; }
					for(int x = 0; x < k; x++){
						if(type[s] != type[s + x]){ continue LOOP; }
					}

					continue QUERY;
				}

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

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

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

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

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

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

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

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

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

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


import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.StringTokenizer;

public class F1 {

	public static void main(String[] args) {
		try (final Scanner sc = new Scanner(System.in)) {
			final int n = sc.nextInt();
			final int m = sc.nextInt();

			int[] count = new int[m + 1];
			for(int i = 0; i < n; i++){
				count[sc.nextInt() - 1]++;
			}
			//System.out.println(Arrays.toString(count));

			for(int i = 0; i < m; i++){
				final int k = sc.nextInt();
				if(k == 0){ throw new RuntimeException(); }

				if(count[i] < k){
					System.out.println("NO");
					return;
				}
			}

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

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

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

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

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

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

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

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

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


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

public class MainF {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n=in.nextInt(), m=in.nextInt();
		int[] a = in.readIntArray(n, -1), b = in.readIntArray(m, 0);
		int sb=0;
		for(int bi : b)
			sb+=bi;
		int[] c = new int[m];
		int cl=m;
		for(int bi : b)
			if(bi==0)
				--cl;
		int i1=0;
		while(cl>0) {
			++c[a[i1]];
			if(c[a[i1]]==b[a[i1]])
				--cl;
			++i1;
		}
		int ans=n+1;
		if(cl==0) {
			for(int i2=0; ;) {
				while(i2<n&&c[a[i2]]>b[a[i2]])
					--c[a[i2++]];
				ans=Math.min(i1-i2-sb, ans);
				if(i1>=n)
					break;
				++c[a[i1++]];
			}
		}
		//E
		out.println(ans==0?"YES":"NO");
		//M
//		out.println(ans>n?-1:ans);
		out.close();
	}

	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			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 int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			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 long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			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() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}


import java.util.Scanner;

/**
Name: Grover A. Irusta Miranda
Company: CodeRoad - xTime
Date 20/04/2018
 */

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int arrayN []= new int  [n];
		int arrayM []= new int  [m];
		boolean flag = false;
		for (int i = 0; i < arrayN.length; i++) {
			arrayN[i]=in.nextInt();
		}
		for (int i = 0; i < arrayM.length; i++) {
			arrayM[i]=in.nextInt();
	}
		int indexAux=0;
		GOTO: for (int i = 0; i < arrayN.length; i++) {
			for (int j = 0; j < arrayM.length; j++) {
				if(i<arrayN.length) {
					if (arrayN[i]==arrayM[j]) {
						if (j+1==arrayM.length) {
							flag = true;
							break GOTO;
						}
						i++;
						indexAux++;
					}
					else {
						i=indexAux;
						indexAux=0;
						break;
					}
				}
			}
		}
		System.out.println(flag?"YES":"NO");
	}

}


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

public class G
{
    public static void main(String[] args)
    {
    	MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), d = sc.nextInt();
        a--;
        b--;
        c--;
        d--;

        int pT = 0, vT = 0;

        if(c != 0 && d != 0) {
        	vT += Math.max(c, d) - Math.min(c, d);
        	vT += c - 1;

        	pT = Math.abs(a - 1) + Math.abs(b - 1);
        } else {
        	pT = a + b;
        	vT = c + d;
        }

        if(pT >= vT)
        	out.println("Polycarp");
        else
        	out.println("Vasiliy");

        out.close();
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

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

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Scanner sc = new Scanner(System.in);
        int xp = sc.nextInt();
        int yp = sc.nextInt();
        int xv = sc.nextInt();
        int yv = sc.nextInt();
        if(xp<=xv&&yp<=yv){
            System.out.println("Polycarp");
        }
        else{
            if(xp>xv&&yp>yv){
                System.out.println("Vasiliy");
            }
            else{
                if(Math.max(xv,yv)>xp+yp){
                    System.out.println("Polycarp");
                }
                else{
                    System.out.println("Vasiliy");
                }
            }
        }
    }
}


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

/**
 * @author master_j
 * @version 0.4.1
 * @since Mar 22, 2015
 */
public class Solution {
    private void solve() throws IOException {
        int x0 = io.nI(), y0 = io.nI();

        int x1 = io.nI(), y1 = io.nI();

        if (x1 == 0 || y1 == 0) {
            int d0 = x0 + y0;
            int d1 = x1 + y1;
            if (d0 <= d1)
                io.wln("Polycarp");
            else
                io.wln("Vasiliy");
            return;
        }

        if (x0 <= x1 && y0 <= y1) {
            io.wln("Polycarp");
            return;
        }

        int d0 = x0 + y0;
        int d1 = Math.max(x0, x1);
        if (d0 <= d1)
            io.wln("Polycarp");
        else
            io.wln("Vasiliy");
    }//2.2250738585072012e-308

    public static void main(String[] args) throws IOException {
        IO.launchSolution(args);
    }

    Solution(IO io) throws IOException {
        this.io = io;
        solve();
    }

    private final IO io;
}

class IO {
    static final String _localArg = "master_j";
    private static final String _problemName = "";
    private static final Mode _inMode = Mode.STD_;
    private static final Mode _outMode = Mode.STD_;
    private static final boolean _autoFlush = false;

    enum Mode {STD_, _PUT_TXT, PROBNAME_}

    private final StreamTokenizer st;
    private final BufferedReader br;
    private final Reader reader;

    private final PrintWriter pw;
    private final Writer writer;

    static void launchSolution(String[] args) throws IOException {
        boolean local = (args.length == 1 && args[0].equals(IO._localArg));
        IO io = new IO(local);

        long nanoTime = 0;
        if (local) {
            nanoTime -= System.nanoTime();
            io.wln("<output>");
        }

        io.flush();
        new Solution(io);
        io.flush();

        if (local) {
            io.wln("</output>");
            nanoTime += System.nanoTime();
            final long D9 = 1000000000, D6 = 1000000, D3 = 1000;
            if (nanoTime >= D9)
                io.wf("%d.%d seconds\n", nanoTime / D9, nanoTime % D9);
            else if (nanoTime >= D6)
                io.wf("%d.%d millis\n", nanoTime / D6, nanoTime % D6);
            else if (nanoTime >= D3)
                io.wf("%d.%d micros\n", nanoTime / D3, nanoTime % D3);
            else
                io.wf("%d nanos\n", nanoTime);
        }

        io.close();
    }

    IO(boolean local) throws IOException {
        if (_inMode == Mode.PROBNAME_ || _outMode == Mode.PROBNAME_)
            if (_problemName.length() == 0)
                throw new IllegalStateException("You imbecile. Where's my <_problemName>?");

        if (_problemName.length() > 0)
            if (_inMode != Mode.PROBNAME_ && _outMode != Mode.PROBNAME_)
                throw new IllegalStateException("You imbecile. What's the <_problemName> for?");

        Locale.setDefault(Locale.US);

        if (local) {
            reader = new FileReader("input.txt");
            writer = new OutputStreamWriter(System.out);
        } else {
            switch (_inMode) {
                case STD_:
                    reader = new InputStreamReader(System.in);
                    break;
                case PROBNAME_:
                    reader = new FileReader(_problemName + ".in");
                    break;
                case _PUT_TXT:
                    reader = new FileReader("input.txt");
                    break;
                default:
                    throw new NullPointerException("You imbecile. Gimme _inMode.");
            }
            switch (_outMode) {
                case STD_:
                    writer = new OutputStreamWriter(System.out);
                    break;
                case PROBNAME_:
                    writer = new FileWriter(_problemName + ".out");
                    break;
                case _PUT_TXT:
                    writer = new FileWriter("output.txt");
                    break;
                default:
                    throw new NullPointerException("You imbecile. Gimme _outMode.");
            }
        }

        br = new BufferedReader(reader);
        st = new StreamTokenizer(br);

        pw = new PrintWriter(writer, _autoFlush);

        if (local && _autoFlush)
            wln("Note: auto-flush is on.");
    }

    //@formatter:off
    void wln()          {pw.println(); }
    void wln(boolean x) {pw.println(x);}
    void wln(char x)    {pw.println(x);}
    void wln(char x[])  {pw.println(x);}
    void wln(double x)  {pw.println(x);}
    void wln(float x)   {pw.println(x);}
    void wln(int x)     {pw.println(x);}
    void wln(long x)    {pw.println(x);}
    void wln(Object x)  {pw.println(x);}
    void wln(String x)  {pw.println(x);}

    void wf(String f, Object... o) {pw.printf(f, o);}

    void w(boolean x)   {pw.print(x);}
    void w(char x) {pw.print(x);}
    void w(char x[]) {pw.print(x);}
    void w(double x)    {pw.print(x);}
    void w(float x)     {pw.print(x);}
    void w(int x)       {pw.print(x);}
    void w(long x)      {pw.print(x);}
    void w(Object x)    {pw.print(x);}
    void w(String x)    {pw.print(x);}

    int nI() throws IOException {st.nextToken(); return (int)st.nval;}
    double nD() throws IOException {st.nextToken(); return st.nval;}
    float nF() throws IOException {st.nextToken(); return (float)st.nval;}
    long nL() throws IOException   {st.nextToken(); return (long)st.nval;}
    String nS() throws IOException {st.nextToken(); return st.sval;}

    int[] nIa(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nI();
        return a;
    }
    double[] nDa(int n) throws IOException {
        double[] a = new double[n];
        for (int i = 0; i < n; i++)
            a[i] = nD();
        return a;
    }
    String[] nSa(int n) throws IOException {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nS();
        return a;
    }

    void wc(String x)         {wc(x.toCharArray());}
    void wc(char c1, char c2) {for (char c = c1; c<=c2; c++) wc(c);}
    void wc(char x[])         {for (char c : x) wc(c); }
    void wc(char x)           {st.ordinaryChar(x); st.wordChars(x, x);}

    public boolean eof() {return st.ttype == StreamTokenizer.TT_EOF;}
    public boolean eol() {return st.ttype == StreamTokenizer.TT_EOL;}

    void flush() {pw.flush();}
    void close() throws IOException {reader.close(); br.close(); flush(); pw.close();}
    //@formatter:on
}


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

public class C {

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

    void solve() throws IOException {
        int x1 = readInt();
        int y1 = readInt();
        int x2 = readInt();
        int y2 = readInt();
        String polycarp = "Polycarp";
        String vasiliy = "Vasiliy";
        if(x1 <= x2 && y1 <= y2) {
            out.println(polycarp);
            return;
        }
        if(x1 >= x2 && y1 >= y2) {
            out.println(polycarp);
            return;
        }
        if(y1 < y2) {
            int dy = y2 - y1;
            if(x1 <= dy) {
                out.println(polycarp);
                return;
            }
        }
        if(x1 < x2) {
            int dx = x2-x1;
            if(y1 <= dx) {
                out.println(polycarp);
                return;
            }
        }
        out.println(vasiliy);
    }

    void init() throws FileNotFoundException {
        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());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    int[] readArr(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readArrL(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = readLong();
        }
        return res;
    }

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

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


public class SportMafia {
public static void main(String [] args ) {
	Scanner sc = new Scanner(System.in);
	long n = sc.nextLong();
	long k= sc.nextLong();
	for (int i=0;i<=n;i++) {
		long m=n-i;
		long  sum=0;
		for (long j=1;j<=m;j++) {
			sum+=j;
		}
		if (sum-i==k) {
			System.out.print(i);
			break;
		}
	}
}
}


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

public class Solve {
    FastScanner in;
    PrintWriter out;

    static long triangularNumberSum(long n) {
        return (n * (n + 1)) / 2;
    }

    void solve() {
        long n = in.nextLong();
        long k = in.nextLong();

        long lower = 0;
        long upper = n;
        long mid = 0;

        while (lower <= upper) {
            mid = lower + (upper - lower) / 2;

            long tn = triangularNumberSum(mid);
            long rem = tn - (n - mid);

            if (rem == k) {
                out.println(n - mid);
                return;
            } else if (rem < k) {
                lower = mid+1;
            } else {
                upper = mid-1;
            }
        }
    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

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

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.util.Scanner;

public class CF1195B{
	static long n,k;
	public static void main(String[] args){
		Scanner cin = new Scanner(System.in);
		n = cin.nextLong();
		k = cin.nextLong();
		System.out.println(n-(long)(-3 + Math.sqrt(9 + 4 * (n + k))) / 2;
	}
}


public class SportMafia {
public static void main(String [] args ) {
	Scanner sc = new Scanner(System.in);
	long n = sc.nextLong();
	long k= sc.nextLong();
	for (int i=0;i<=n;i++) {
		long m=n-i;
		long  sum=0;
		for (long j=1;j<=m;j++) {
			sum+=j;
		}
		if (sum-i==k) {
			System.out.print(i);
			break;
		}

	}
}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskF {
        int f;
        int w;
        int h;
        final int mod = (int) (1e9 + 7);
        long[] fact = IntegerUtils.generateFactorial((int) (1e5 + 5), mod);
        long[] revFact = IntegerUtils.generateReverseFactorials((int) (1e5 + 5), mod);

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            f = in.readInt();
            w = in.readInt();
            h = in.readInt();

            if (f == 0 || w == 0) {
                out.printLine(w <= h ? 0 : 1);
                return;
            }

            long p = 0;
            for (int cw = 1; cw <= w && 0 <= w - cw * (h + 1); cw++) {
                int rem = w - cw * (h + 1);
                for (int cf = Math.max(cw - 1, 1); cf <= Math.min(f, cw + 1); cf++) {
                    long cur = f(cw, rem) * f(cf, f - cf) % mod;
                    p += cur;
                    if (cw == cf) {
                        p += cur;
                    }
                    p %= mod;
                }
            }

            long q = 0;
            for (int cw = 1; cw <= w; cw++) {
                for (int cf = Math.max(cw - 1, 1); cf <= Math.min(f, cw + 1); cf++) {
                    long cur = f(cw, w - cw) * f(cf, f - cf) % mod;
                    q += cur;
                    if (cw == cf) {
                        q += cur;
                    }
                    q %= mod;
//                out.printLine(cw, cf, cur, q);
                }
            }
//        out.printLine(p + "/" + q);
            out.printLine(p * IntegerUtils.reverse(q, mod) % mod);
        }

        private long f(int n, int s) {
            return comb(n - 1, s + n - 1);
        }

        private long comb(int m, int n) {
            return fact[n] * revFact[m] % mod * revFact[n - m] % mod;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class IntegerUtils {
        public static long power(long base, long exponent, long mod) {
            if (base >= mod) {
                base %= mod;
            }
            if (exponent == 0) {
                return 1 % mod;
            }
            long result = power(base, exponent >> 1, mod);
            result = result * result % mod;
            if ((exponent & 1) != 0) {
                result = result * base % mod;
            }
            return result;
        }

        public static long[] generateFactorial(int count, long module) {
            long[] result = new long[count];
            if (module == -1) {
                if (count != 0) {
                    result[0] = 1;
                }
                for (int i = 1; i < count; i++) {
                    result[i] = result[i - 1] * i;
                }
            } else {
                if (count != 0) {
                    result[0] = 1 % module;
                }
                for (int i = 1; i < count; i++) {
                    result[i] = (result[i - 1] * i) % module;
                }
            }
            return result;
        }

        public static long reverse(long number, long module) {
            return power(number, module - 2, module);
        }

        public static long[] generateReverse(int upTo, long module) {
            long[] result = new long[upTo];
            if (upTo > 1) {
                result[1] = 1;
            }
            for (int i = 2; i < upTo; i++) {
                result[i] = (module - module / i * result[((int) (module % i))] % module) % module;
            }
            return result;
        }

        public static long[] generateReverseFactorials(int upTo, long module) {
            long[] result = generateReverse(upTo, module);
            if (upTo > 0) {
                result[0] = 1;
            }
            for (int i = 1; i < upTo; i++) {
                result[i] = result[i] * result[i - 1] % module;
            }
            return result;
        }

    }

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

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

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

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

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

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

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

        }

    }
}


/**
 * @author derrick20
 */

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

public class BarrelsBoxes {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int F = sc.nextInt();
        int W = sc.nextInt();
        int H = sc.nextInt();

        int MAX = (int) 1e5; // todo change this!
        fact = new long[MAX + 1];
        invFact = new long[MAX + 1];
        fact[0] = 1;
        invFact[0] = 1;
        for (int i = 1; i <= MAX; i++) {
            fact[i] = ((long) i * fact[i - 1]) % mod;
            invFact[i] = inv(fact[i]);
        }

        long good = 0;
        for (int k = 1; W - k * (H + 1) >= 0 && F >= k - 1; k++) {
            long amt = (choose(W - k * (H + 1), k - 1) * choose(F + 1, k)) % mod;
            good = (good + amt) % mod;
        }
        long total = 0;
        for (int k = 1; W - k >= 0 && F >= k - 1; k++) {
            long amt = (choose(W - 1, k - 1) * choose(F + 1, k)) % mod;
            total = (total + amt) % mod;
        }
        long prob = (good * inv(total)) % mod;
        out.println(prob);
        out.close();
    }

    // todo SET THE MOD
    static long mod = (long) 1e9 + 7;
    static long[] fact, invFact;

    static long choose(int n, int k) {
        ASSERT(k <= n, "Invalid choose");
        long ans = (fact[n] * invFact[n - k]) % mod;
        return (ans * invFact[k]) % mod;
    }

    static long inv(long x) {
        return fastExpo(x, mod - 2);
    }

    static long fastExpo(long x, long k) {
        long ans = 1;
        long bit = x;
        while (k > 0) {
            if (k % 2 == 1) {
                ans = (bit * ans) % mod;
            }
            bit = (bit * bit) % mod;
            k /= 2;
        }
        return ans;
    }

    static class FastScanner {
        private int BS = 1 << 16;
        private char NC = (char) 0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            } catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar() {
            while (bId == size) {
                try {
                    size = in.read(buf);
                } catch (Exception e) {
                    return NC;
                }
                if (size == -1) return NC;
                bId = 0;
            }
            return (char) buf[bId++];
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt = 1;
            boolean neg = false;
            if (c == NC) c = getChar();
            for (; (c < '0' || c > '9'); c = getChar()) {
                if (c == '-') neg = true;
            }
            long res = 0;
            for (; c >= '0' && c <= '9'; c = getChar()) {
                res = (res << 3) + (res << 1) + c - '0';
                cnt *= 10;
            }
            return neg ? -res : res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c != '.' ? cur : cur + nextLong() / cnt;
        }

        public double[] nextDoubles(int N) {
            double[] res = new double[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c > 32) {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c != '\n') {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if (c > 32) return true;
            while (true) {
                c = getChar();
                if (c == NC) return false;
                else if (c > 32) return true;
            }
        }
    }

    static void ASSERT(boolean assertion, String message) {
        if (!assertion) throw new AssertionError(message);
    }
}


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

public final class barels_and_boxes
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long[] fact,inv_fact;
	static int maxn=(int)(2e5+5);
	static long mod=(long)(1e9+7);

	static int add(long a,long b)
	{
		long ret=a+b;

		if(ret>=mod)
		{
			ret%=mod;
		}

		return (int)ret;
	}

	static int mul(long a,long b)
	{
		long ret=a*b;

		if(ret>=mod)
		{
			ret%=mod;
		}

		return (int)ret;
	}

	static long pow(long a,long b)
	{
		long x=1,y=a;

		while(b>0)
		{
			if(b%2==1)
			{
				x=(x*y)%mod;
			}

			y=(y*y)%mod;b=b/2;
		}

		return x;
	}

	static void build()
	{
		fact=new long[maxn];inv_fact=new long[maxn];fact[0]=1;

		for(int i=1;i<maxn;i++)
		{
			fact[i]=(fact[i-1]*i)%mod;
		}

		inv_fact[maxn-1]=pow(fact[maxn-1],mod-2);

		for(int i=maxn-2;i>=0;i--)
		{
			inv_fact[i]=(inv_fact[i+1]*(i+1))%mod;
		}
	}

	static long C(int n,int r)
	{
		if(n-r<0 || Math.min(n,r)<0)
		{
			return 0;
		}

		long val1=fact[n],val2=inv_fact[r],val3=inv_fact[n-r];

		long mul=(val2*val3)%mod;

		return (val1*mul)%mod;
	}

	static long get(long tot,int nums,int flag)
	{
		if(nums==0)
		{
			return (tot==0?1:0);
		}

		else
		{
			if(flag==1)
			{
				return C((int)(tot-1),nums-1);
			}

			else
			{
				return C((int)tot+nums-1,nums-1);
			}
		}
	}

    public static void main(String args[]) throws Exception
    {
		build();

		int f=sc.nextInt(),w=sc.nextInt(),h=sc.nextInt();

		long p=0,q=0;

		for(int i=1;i<=Math.min(f,w);i++)
		{
			long val1=C(f-1,i-1),val2=C(w-1,i-1);

			long zz=mul(val1,val2);

			zz=mul(zz,2);

			q=add(q,zz);

		}

		for(int i=1;i<=f;i++)
		{
			if(w>=i-1)
			{
				long val1=C(f-1,i-1),val2=get(w,i-1,1);

				long zz=mul(val1,val2);

				q=add(q,zz);
			}
		}

		for(int i=1;i<=w;i++)
		{
			if(f>=i-1)
			{
				long val1=C(w-1,i-1),val2=get(f,i-1,1);

				long zz=mul(val1,val2);

				q=add(q,zz);
			}
		}

		for(int i=1;i<=Math.min(f,w);i++)
		{
			long now=(1L*w)-((i*1L*(h+1)));

			if(now>=0)
			{
				long val1=C(f-1,i-1),val2=C((int)(now+i-1),i-1);

				long zz=mul(val1,val2);

				zz=mul(zz,2);

				p=add(p,zz);
			}

		}

		for(int i=1;i<=f;i++)
		{
			if(w>=i-1)
			{
				long now=(w*1L)-((i-1)*1L*(h+1));

				if(now>=0)
				{
					long val1=C(f-1,i-1),val2=get(now,i-1,h==0?1:-1);

					long zz=mul(val1,val2);

					p=add(p,zz);
				}
			}
		}

		for(int i=1;i<=w;i++)
		{
			if(f>=i-1)
			{
				long now=(w*1L)-(i*1L*(h+1));

				if(now>=0)
				{
					long val1=get(now,i,h==0?1:-1),val2=get(f,i-1,1);

					long zz=mul(val1,val2);

					p=add(p,zz);
				}
			}
		}

		long den=pow(q,mod-2),res=mul(p,den);

		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

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

	public String next() throws Exception {
		return nextToken().toString();
	}

    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.util.Scanner;
public class F399 {

	public static final long p = 1_000_000_007;
	public static long[] factorial;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int food = in.nextInt();
		int wine = in.nextInt();
		int H = in.nextInt();
		in.close();

		factorial = new long[200001];
		factorial[0] = 1;
		for(int i = 1; i < factorial.length; i++)
			factorial[i] = (factorial[i-1] * i) % p;

		long result = answer(food, wine, H);
		System.out.println(result);
	}

	public static long answer(int food, int wine, int H) {
		if(food == 0) {
			return wine > H? 1 : 0;
		}
		if(wine == 0) {
			return 1;
		}

		long[] foodArr = new long[1 + Math.max(food, wine)];
		long[] wineArr = new long[1 + Math.max(food, wine)];

		for(int i = 1; i < food+1; i++) {
			foodArr[i] = nCr(food - 1, i - 1);
		}

		for(int i = 1; i < wine+1; i++) {
			wineArr[i] = nCr(wine - 1, i - 1);
		}

//		System.out.println("food:");
//		for(int i = 0; i < Math.min(20, foodArr.length); i++)
//			System.out.print(foodArr[i] + " ");
//		System.out.println();
//		System.out.println("foodArr: " + Arrays.toString(foodArr));
//		System.out.println("wineArr: " + Arrays.toString(wineArr));

		long denom = 0;
		for(int i = 1; i < foodArr.length; i++) {
			denom += 2 * wineArr[i] * foodArr[i];
//			if(2*wineArr[i]*foodArr[i] < 0) {
//				System.out.println("WAHT1");
//			}
			denom %= p;
		}

		for(int i = 1; i < foodArr.length-1; i++) {
			denom += foodArr[i] * wineArr[i+1];
			denom += wineArr[i] * foodArr[i+1];
//			if(foodArr[i] * wineArr[i+1] < 0 || wineArr[i] * foodArr[i+1] < 0)
//				System.out.println("WAHT2");
			denom %= p;
		}

//		System.out.println("denom = " + denom);
		long[] validWine = new long[wineArr.length];
		for(int i = 1; i < validWine.length; i++) {
			validWine[i] = nCr(wine + i - 1 - i*(H+1), i-1);
		}

		long numer = 0;
		for(int i = 1; i < foodArr.length; i++) {
			numer += 2 * validWine[i] * foodArr[i];
			numer %= p;
		}

		for(int i = 1; i < foodArr.length-1; i++) {
			numer += foodArr[i] * validWine[i+1];
			numer += validWine[i] * foodArr[i+1];
			numer %= p;
		}

//		System.out.println("numer = " + numer);
//		System.out.println("denom = " + denom);

		long denomInv = modInverse(denom, p);
		long result = numer * denomInv % p;

		return result;
	}

	public static long nCr(int N, int R) {
		if(N == 0 && R == 0) return 1;
		if(N < 0) return 0;
		if(N < R) return 0;

		long result = factorial[N];
		long denom1 = modInverse(factorial[R], p);
		long denom2 = modInverse(factorial[N-R], p);

		result = (result * denom1) % p;
		result = (result * denom2) % p;

		return result;
	}

	//Extended Euclidean algorithm find x such that ax = 1 (mod m)
	public static long modInverse(long a, long m) {
		long[] a1 = {a, 1, 0};
		long[] b1 = {m, 0, 1};
		while(b1[0] != 0) {
			long[] c1 = new long[3];
			long q = a1[0] / b1[0];
			c1[0] = a1[0] - q * b1[0];
			c1[1] = a1[1] - q * b1[1];
			c1[2] = a1[2] - q * b1[2];
			a1 = b1;
			b1 = c1;
		}

		if(a1[1] < 0) a1[1] += m;
		return a1[1];
	}

}
/*
1 1 1
outputCopy
0
inputCopy
1 2 1
outputCopy
666666672

4138 4245 30
105072868
*/


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

public class Solution {

    StreamTokenizer in;
    PrintWriter out;

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

    String next() throws Exception {
        in.nextToken();
        return  in.sval;
    }

    public void run() throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        String st = next();
        int n=st.length();
        int [] b = new int [n];
        long [][] a = new long [50][10];
        long q;

        for (int i=0; i<n;i++)
        {
            b[i]=st.charAt(i)-'0';
        }
        for (int i=1;i<=10;i++) a[0][i-1]=1;
        for (int i=1;i<st.length();i++)
            for (int j=0; j<10;j++)
            {
                q=(j+b[i]);
                a[i][q/2] +=a[i-1][j];
                if ((j+b[i])%2!=0)
                    a[i][q/2+1] +=a[i-1][j];
            }
        q=0;
        for (int j=0; j<10; j++)
            q=q+a[st.length()][j];
        long p;
        int t=0;
        for (int i=1; i<=st.length(); i++)
        {
            p=(b[i]+b[i-1]);
            if (p%2==0)
                if (p/2!=b[i]) t=1;
            if (p%2!=0)
                if ((p/2!=b[i])&&(p/2+1!=b[i])) t=1;
        }
        if (t==0) q--;
        out.println(q);
        out.flush();
    }

}


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

import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
//      br = new BufferedReader(new FileReader("input.txt"));
//      PrintWriter pw = new PrintWriter("output.txt");
        char[] s = next().toCharArray();
        int n = s.length;
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = s[i] - '0';
        long[][] dp = new long[n][10];
        for (int i = 0; i < 10; i++) {
            dp[0][i] = 1;
        }
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < 10; j++) {
                int dig = (j + a[i + 1]) / 2;
                int mo = (j + a[i + 1]) % 2;
                d[i + 1][dig] += d[i][j];
                if (mo == 1) {
                    d[i + 1][dig + 1] += d[i][j];
                }
            }
        }
        long ans = 0;
        for (int i = 0; i < 10; i++) {
            ans += dp[n - 1][i];
        }
        boolean check = true;
        for (int i = 1; i < n; ++i) {
            int dig = (a[i - 1] + a[i]) / 2;
            int mo = (a[i - 1] + a[i]) % 2;
            if (dig != a[i] && (mo == 0 || dig + 1 != a[i])) {
                check = false;
                break;
            }
        }
        if (check) ans--;
        pw.println(ans);
        pw.close();
    }

    static long mod = 1000000007;

    static StringTokenizer st = new StringTokenizer("");
    static BufferedReader br;

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

    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());
    }
}
        /*2 1 1
        2 1 2
        3 1 1
        3 1 2
        3 2 2
        3 1 3
        3 2 3
        4 1 1
        4 1 2
        4 2 2
        4 1 3
        4 2 3
        4 3 3
        4 1 4
        4 2 4
        4 3 4
        5 1 1
        5 1 2
        5 2 2
        5 1 3
        5 2 3
        5 3 3
        5 1 4
        5 2 4
        5 3 4
        5 4 4
        5 1 5
        5 2 5
        5 3 5
        5 4 5
        6 1 1
        6 1 2
        6 2 2
        6 1 3
        6 2 3
        6 3 3
        6 1 4
        6 2 4
        6 3 4
        6 4 4
        6 1 5
        6 2 5
        6 3 5
        6 4 5
        6 5 5
        6 1 6
        6 2 6
        6 3 6
        6 4 6
        6 5 6
        7 1 1
        7 1 2
        7 2 2
        7 1 3
        7 2 3
        7 3 3
        7 1 4
        7 2 4
        7 3 4
        7 4 4
        7 1 5
        7 2 5
        7 3 5
        7 4 5
        7 5 5
        7 1 6
        7 2 6
        7 3 6
        7 4 6
        7 5 6
        7 6 6*/
//        7 1 7


package contest44;

import java.util.Scanner;

public class H {

    public static void main(String[] args){

        Scanner in = new Scanner(System.in);

        String s = in.next();
        int l = s.length();

        long[][] dp = new long[l][10];
        for( int i = 0; i <= 9; i++){
          dp[0][i] = 1;
        }

        for( int i = 1; i < l; i++){
           int r = s.charAt(i) - '0';
           for(int j = 0; j < 10; j++){
              if( ((j + r)) % 2 == 0){
                  dp[i][(j+r)/2] += dp[i-1][j];
              }
              else{
                dp[i][(j+r)/2] += dp[i-1][j];
                dp[i][(j+r+1)/2] += dp[i-1][j];
              }
           }
        }

        long ans = 0;
        for( int i = 0; i < 10; i++){
          ans += dp[l-1][i];
        }

        boolean flag = true;
        for( int i = 1; i < l; i++){
          int r = s.charAt(i-1)-'0';
          int c = s.charAt(i) - '0';
          if( (r + c)%2 == 0 && (r+c)/2 == c ){
             continue;
          }
          if( (r+c)/2 == c || (r+c+1)/2 == c){
            continue;
          }
          flag = false;
          break;
        }

        if(flag) ans--;

        System.out.println(ans);

    }
}


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

public class Codeforces
{
  private StreamTokenizer st;
  public PrintWriter pw;
  public static final int modulo = 1000000009;

  void init(String in, String out)
  {
    if (in.isEmpty())
      st = new StreamTokenizer(System.in);
    else
    {
      try
      {
        st = new StreamTokenizer(new BufferedReader(new FileReader(in)));
      }
      catch(FileNotFoundException e)
      {

      }
    }

    if (out.isEmpty())
      pw = new PrintWriter(System.out);
    else
    {
      try
      {
        pw = new PrintWriter(new FileWriter(out));
      }
      catch(IOException e)
      {

      }
    }
  }

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

  private int nI()
  {
    try{
      st.nextToken();
    }
    catch(IOException e)
    {

    }
    return (int)st.nval;
  }

  private double nD()
  {
    try{
      st.nextToken();
    }
    catch(IOException e)
    {

    }
    return st.nval;
  }

  private String nS()
  {
    try{
      st.nextToken();
    }
    catch(IOException e)
    {

    }
    return st.sval;
  }

  private long nL()
  {
    try{
      st.nextToken();
    }
    catch(IOException e)
    {

    }
    return (long)st.nval;
  }

  public static void main(String[] aslkdjlkgja) throws IOException
  {
    Codeforces z = new Codeforces();
    //z.init("in.txt", "");
    Scanner in = new Scanner(System.in);
    String s = z.nS();
    s = in.next();
    in.close();

    int f[][][] = new int[s.length()+1][10][10];

    for (int k = 1; k <= s.length(); ++k)
      for (int i = 0; i < 10; ++i)
        for (int j = 0; j < 10; ++j)
          f[k][i][j] = 0;

    for (int i = 0; i < 10; ++i)
      f[1][i][i] = 1;

    for (int i = 0; i < 10; ++i)
      for (int k = 2; k <= s.length(); ++k)
        for (int j = 0; j < 10; ++j)
        {
          int c = Integer.parseInt(s.charAt(k-1)+"");

          if ( j % 2 == c % 2)
            f[k][(j + c) /2][i] += f[k-1][j][i];
          else
          {
            f[k][(j + c) /2][i] += f[k-1][j][i];
            f[k][(j + c) /2 + 1][i] += f[k-1][j][i];
          }
        }

    int sum = 0;
    for (int i = 0; i < 10; ++i)
        for (int j = 0; j < 10; ++j)
          sum += f[s.length()][i][j];

    int c = Integer.parseInt(s.charAt(0)+"");
    int d;
    boolean erase = true;
    for (int i = 1; i < s.length(); ++i)
    {
      d = Integer.parseInt(s.charAt(i)+"");
      if ( d % 2 == c % 2)
      {
        if ((d + c) / 2 != d)
          erase = false;
      }
      else
      {
        if ( (d+c)/2 != c &&  (d+c)/2 + 1 != c)
          erase = false;
      }
      c = d;
    }

    if (erase)
      --sum;
    z.pw.print(sum);

    z.close();
  }
}


import java.io.*;
public class LimakAndRadewoosh
{
public static void main(String[] args)
{
String Pobeda = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
String s1 = br.readLine();
String s2 = s1.substring(0,s1.length());
String n = br.readLine();
String t = br.readLine();
String t2 = t.substring(0,t.length());
int count = Integer.parseInt(0,s1.indexOf(" "));
int c = Integer.parseInt(s1.indexOf(" ") + 1,s1.length());
int[] timeLimak = new int[count];
int[] timeRadewoosh = new int[count];
int[] zadachaLimak = new int[count];
int[] zadachaRadewoosh = new int[count];
int[] resLimak = new int[count];
int[] resRadewoosh = new int[count];
int itogLimak = 0;
int itogRadewoosh = 0;
for(int i = 0; i < count;i++)
{
 zadachaLimak[i] = Integer.parseInt(s.substring(0,s.indexOf(" ")));
 s.replace(s.substring(0,s.indexOf(" ")),"");
 timeLimak[i] = Integer.parseInt(t.substring(0,t.indexOf(" ")));
 t.replace(t.substring(0,t.indexOf(" ")));

}
for(int i = count;i >= 0;i--)
{
      zadachaRadewoosh[i] = Integer.parseInt(s1.substring(s1.lastIndexOf(" "),s1.length()));
      s1.replace(s1.substring(s1.lastIndexOf(" "),""));
      timeRadewoosh[i] = Integer.parseInt(t2.substring(t2.lastIndexOf(" "),t2.length()));
      t2.replace(t2.lastIndexOf(" "),t2.length());
}
for(int i = 0;i < count;i++)
{
 resLimak[i] = zadachaLimak[i] - (c * timeLimak[i]);
}
for(int i = count;i >= 0;i--)
{
      resRadewoosh[i] = zadachaRadewoosh[i] - (c * timeRadewoosh[i]);
}
for(int u = 0,p = count;u < count && p >= 0;u++,p--)
{
      itogLimak += resLimak[u];
      itogRadewoosh += resRadewoosh[p];
}
if(itogLimak > itogRadewoosh)
{
 Pobeda = "Limak";
}
else if(itogRadewoosh > itogLimak)
{
 Pobeda = "Radewoosh";
}
else if(itogLimak == itogRadewoosh)
{
      Pobeda = "Tie";
}
}
catch(Exception excp)
{

}
finally
{
      System.out.println(Pobeda);
}
}
}


import java.io.*;
public class LimakAndRadewoosh
{
public static void main(String[] args)
{
String Pobeda = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
StringBuffer o = new StringBuffer(br.readLine());
StringBuffer s1 = new StringBuffer(br.readLine());
StringBuffer s2 = new StringBuffer(s1.substring(0,s1.length()));
StringBuffer t = new StringBuffer(br.readLine());
StringBuffer t2 = t.substring(0,t.length());
int count = Integer.parseInt(o.substring(0,spo.indexOf(" ")));
int c = Integer.parseInt(o.substring(s1.indexOf(" ") + 1,o.length()));
int[] timeLimak = new int[count];
int[] timeRadewoosh = new int[count];
int[] zadachaLimak = new int[count];
int[] zadachaRadewoosh = new int[count];
int[] resLimak = new int[count];
int[] resRadewoosh = new int[count];
int itogLimak = 0;
int itogRadewoosh = 0;
for(int i = 0; i < count;i++)
{
 zadachaLimak[i] = Integer.parseInt(s1.substring(0,s1.indexOf(" ")));
 s1.delete(0,s1.indexOf(" "));
 timeLimak[i] = Integer.parseInt(t.substring(0,t.indexOf(" ")));
 t.delete(0,t.indexOf(" "));

}
for(int i = count;i >= 0;i--)
{
      zadachaRadewoosh[i] = Integer.parseInt(s2.substring(s2.lastIndexOf(" "),s2.length()));
      s2.delete(s2.lastIndexOf(" "),s2.length();
      timeRadewoosh[i] = Integer.parseInt(t2.substring(t2.lastIndexOf(" "),t2.length()));
      t2.delete(t2.lastIndexOf(" "),t2.length());
}
for(int i = 0;i < count;i++)
{
 resLimak[i] = zadachaLimak[i] - (c * timeLimak[i]);
}
for(int i = count;i >= 0;i--)
{
      resRadewoosh[i] = zadachaRadewoosh[i] - (c * timeRadewoosh[i]);
}
for(int u = 0,p = count;u < count && p >= 0;u++,p--)
{
      itogLimak += resLimak[u];
      itogRadewoosh += resRadewoosh[p];
}
if(itogLimak > itogRadewoosh)
{
 Pobeda = "Limak";
}
else if(itogRadewoosh > itogLimak)
{
 Pobeda = "Radewoosh";
}
else if(itogLimak == itogRadewoosh)
{
      Pobeda = "Tie";
}
}
catch(Exception excp)
{

}
finally
{
      System.out.println(Pobeda);
}
}
}


import java.util.*;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c = sc.nextInt();
		sc.nextLine();
		int[] p = new int[n+1];
		int [] t = new int[n+1];
		for (int i=0;i<n;i++)
		{
			p[i] = sc.nextInt();
		}
		sc.nextLine();

		for (int i=0;i<n;i++)
		{
			t[i] = sc.nextInt();
		}
		Limak obj = new Limak();
		Rade o = new Rade();
		int score1 = obj.getforLimak(n,c,p,t);
		int score2 = o.getforRade(n,c,p,t);

		if (score1>score2)
			System.out.println("Limak");
		else if (score1==score2)
			System.out.println("Tie");
		else
			System.out.println("Radewoosh");
	}

}

public class Limak {

	public int getforLimak(int n,int c,int[] p,int[] t)
	{
		int score=0;
		int tempscore =0;
		int x=t[0];
		for (int i=0;i<n;i++)
		{
			tempscore = p[i] -c*x;
			if (tempscore>0)
				tempscore=tempscore;
			else
				tempscore=0;

			score = score +tempscore;
			if (i<n-1)
			x = x+t[i+1];

		}
		return score;
	}

}

public class Rade {

	public int getforRade(int n,int c,int[] p,int[] t)
	{
		int score=0;
		int tempscore =0;
		int x=t[n-1];
		for (int i=n-1;i>=0;i--)
		{
			tempscore = p[i] -c*x;
			if (tempscore>0)
				tempscore=tempscore;
			else
				tempscore=0;

			score = score +tempscore;
			if (i>0)
			x = x+t[--i];

		}
		return score;
	}

}


import java.io.*;
public class LimakAndRadewoosh
{
public static void main(String[] args)
{
String Pobeda = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
String s1 = br.readLine();
String s2 = s1.substring(0,s1.length());
String n = br.readLine();
String t = br.readLine();
String t2 = t.substring(0,t.length());
int count = Integer.parseInt(s1.substring(0,s1.indexOf(" ")));
int c = Integer.parseInt(s1.substring(s1.indexOf(" ") + 1,s1.length()));
int[] timeLimak = new int[count];
int[] timeRadewoosh = new int[count];
int[] zadachaLimak = new int[count];
int[] zadachaRadewoosh = new int[count];
int[] resLimak = new int[count];
int[] resRadewoosh = new int[count];
int itogLimak = 0;
int itogRadewoosh = 0;
for(int i = 0; i < count;i++)
{
 zadachaLimak[i] = Integer.parseInt(s1.substring(0,s1.indexOf(" ")));
 s.replace(s.substring(0,s.indexOf(" ")),"");
 timeLimak[i] = Integer.parseInt(t.substring(0,t.indexOf(" ")));
 t.replace(t.substring(0,t.indexOf(" ")));

}
for(int i = count;i >= 0;i--)
{
      zadachaRadewoosh[i] = Integer.parseInt(s2.substring(s2.lastIndexOf(" "),s2.length()));
      s2.replace(s2.substring(s2.lastIndexOf(" "),s2.length()));
      timeRadewoosh[i] = Integer.parseInt(t2.substring(t2.lastIndexOf(" "),t2.length()));
      t2.replace(t2.substring(t2.lastIndexOf(" "),t2.length()));
}
for(int i = 0;i < count;i++)
{
 resLimak[i] = zadachaLimak[i] - (c * timeLimak[i]);
}
for(int i = count;i >= 0;i--)
{
      resRadewoosh[i] = zadachaRadewoosh[i] - (c * timeRadewoosh[i]);
}
for(int u = 0,p = count;u < count && p >= 0;u++,p--)
{
      itogLimak += resLimak[u];
      itogRadewoosh += resRadewoosh[p];
}
if(itogLimak > itogRadewoosh)
{
 Pobeda = "Limak";
}
else if(itogRadewoosh > itogLimak)
{
 Pobeda = "Radewoosh";
}
else if(itogLimak == itogRadewoosh)
{
      Pobeda = "Tie";
}
}
catch(Exception excp)
{

}
finally
{
      System.out.println(Pobeda);
}
}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskD {
        private int[] s = {8, -1, -1, -1, 6, 9, 4, -1, 0, 5};

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String str = in.nextString();
            int length = str.length();
            for (int i = 0, j = length - 1; i < j; i++, j--) {
                if (str.charAt(i) != str.charAt(j) && s[str.charAt(i) - '0'] != str.charAt(j) - '0') {
                    out.printLine("No");
                    return;
                }
            }
            if (length % 2 != 0) {
                if (str.charAt(length / 2) != '3' && str.charAt(length / 2) != '7') {
                    out.printLine("No");
                    return;
                }
            }
            out.printLine("Yes");
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

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

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

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

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

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

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

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

        }

    }
}


import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String ch = in.next();
        if (ch.length() == 1 && (ch.equals("2") || ch.equals("8") || ch.equals("9")
                || ch.equals("0") || ch.equals("5") || ch.equals("4") || ch.equals("6") || ch.equals("1"))) {
            out.println("No");
            out.close();
            return;
        }
        int mid = (ch.length() % 2 == 0) ? ch.length() / 2 - 1 : ch.length() / 2;
        if (ch.contains("2") || ch.contains("1")) {
            out.println("No");
        } else {
            boolean test = true;
            for (int i = 0; i < mid; i++) {
                for (int j = ch.length() - 1; j > mid; j--) {
                    if (ch.charAt(i) == '3') {
                        if (ch.charAt(j) != '3') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '7') {
                        if (ch.charAt(j) != '7') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '4') {
                        if (ch.charAt(j) != '6') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '6') {
                        if (ch.charAt(j) != '4') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '5') {
                        if (ch.charAt(j) != '9') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '9') {
                        if (ch.charAt(j) != '5') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '8') {
                        if (ch.charAt(j) != '0') {
                            test = false;
                        }
                    } else if (ch.charAt(i) == '0') {
                        if (ch.charAt(j) != '8') {
                            test = false;
                        }
                    }
                }
            }
            if (test) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }
        out.close();
    }

    static class FastScanner {

        private BufferedReader in;
        private String[] line;
        private int index;
        private int size;

        public FastScanner(InputStream in) throws IOException {
            this.in = new BufferedReader(new InputStreamReader(in));
            init();
        }

        public FastScanner(String file) throws FileNotFoundException {
            this.in = new BufferedReader(new FileReader(file));
        }

        private void init() throws IOException {
            line = in.readLine().split(" ");
            index = 0;
            size = line.length;
        }

        public int nextInt() throws IOException {
            if (index == size) {
                init();
            }
            return Integer.parseInt(line[index++]);
        }

        public long nextLong() throws IOException {
            if (index == size) {
                init();
            }
            return Long.parseLong(line[index++]);
        }

        public float nextFloat() throws IOException {
            if (index == size) {
                init();
            }
            return Float.parseFloat(line[index++]);
        }

        public double nextDouble() throws IOException {
            if (index == size) {
                init();
            }
            return Double.parseDouble(line[index++]);
        }

        public String next() throws IOException {
            if (index == size) {
                init();
            }
            return line[index++];
        }

        public String nextLine() throws IOException {
            if (index == size) {
                init();
            }
            StringBuilder sb = new StringBuilder();
            for (int i = index; i < size; i++) {
                sb.append(line[i]).append(" ");
            }
            return sb.toString();
        }

        private int[] nextIntArray(int n) throws IOException {
            int[] tab = new int[n];
            for (int i = 0; i < tab.length; i++) {
                tab[i] = nextInt();
            }
            return tab;
        }

    }

}


import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String ch = in.next();
        if (ch.length() == 1 && (ch.equals("2") || ch.equals("8") || ch.equals("9")
                || ch.equals("0") || ch.equals("5") || ch.equals("4") || ch.equals("6") || ch.equals("1"))) {
            out.println("No");
            out.close();
            return;
        }
        int mid = (ch.length() % 2 == 0) ? ch.length() / 2 - 1 : ch.length() / 2;
        if (ch.contains("2") || ch.contains("1")) {
            out.println("No");
        } else {
            boolean test = true;
            for (int i = 0; i < mid; i++) {

                    if (ch.charAt(i) == '3') {
                        if (ch.charAt(ch.length()-1-i) != '3') {
                            test = false;
                            System.out.println(ch.charAt(i));
                        }
                    } else if (ch.charAt(i) == '7') {
                        if (ch.charAt(ch.length()-1-i) != '7') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    } else if (ch.charAt(i) == '4') {
                        if (ch.charAt(ch.length()-1-i) != '6') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    } else if (ch.charAt(i) == '6') {
                        if (ch.charAt(ch.length()-1-i) != '4') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    } else if (ch.charAt(i) == '5') {
                        if (ch.charAt(ch.length()-1-i) != '9') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    } else if (ch.charAt(i) == '9') {
                        if (ch.charAt(ch.length()-1-i) != '5') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    } else if (ch.charAt(i) == '8') {
                        if (ch.charAt(ch.length()-1-i) != '0') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    } else if (ch.charAt(i) == '0') {
                        if (ch.charAt(ch.length()-1-i) != '8') {
                            test = false;
                            System.out.println(ch.charAt(i));

                        }
                    }
                }

            if (test) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }
        out.close();
    }

    static class FastScanner {

        private BufferedReader in;
        private String[] line;
        private int index;
        private int size;

        public FastScanner(InputStream in) throws IOException {
            this.in = new BufferedReader(new InputStreamReader(in));
            init();
        }

        public FastScanner(String file) throws FileNotFoundException {
            this.in = new BufferedReader(new FileReader(file));
        }

        private void init() throws IOException {
            line = in.readLine().split(" ");
            index = 0;
            size = line.length;
        }

        public int nextInt() throws IOException {
            if (index == size) {
                init();
            }
            return Integer.parseInt(line[index++]);
        }

        public long nextLong() throws IOException {
            if (index == size) {
                init();
            }
            return Long.parseLong(line[index++]);
        }

        public float nextFloat() throws IOException {
            if (index == size) {
                init();
            }
            return Float.parseFloat(line[index++]);
        }

        public double nextDouble() throws IOException {
            if (index == size) {
                init();
            }
            return Double.parseDouble(line[index++]);
        }

        public String next() throws IOException {
            if (index == size) {
                init();
            }
            return line[index++];
        }

        public String nextLine() throws IOException {
            if (index == size) {
                init();
            }
            StringBuilder sb = new StringBuilder();
            for (int i = index; i < size; i++) {
                sb.append(line[i]).append(" ");
            }
            return sb.toString();
        }

        private int[] nextIntArray(int n) throws IOException {
            int[] tab = new int[n];
            for (int i = 0; i < tab.length; i++) {
                tab[i] = nextInt();
            }
            return tab;
        }

    }

}


import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String ch = in.next();
        int mid = (ch.length() % 2 == 0) ? ch.length() / 2 - 1 : ch.length() / 2;
        if (ch.charAt(mid) == '2' && ch.length() % 2 == 0) {
            out.println("No");
        } else {
            boolean test = true;
            for (int i = 0; i < mid; i++) {
                for (int j = ch.length()-1; j >mid; j--) {
                   if(ch.charAt(i)=='3'){
                       if(ch.charAt(j)!='3'){
                           test=false;
                       }
                   }else if(ch.contains("2")||ch.contains("1")){
                       test = false;
                   }else if(ch.charAt(i)=='7'){
                       if(ch.charAt(j)!='7'){
                           test=false;
                       }
                   }else if(ch.charAt(i)=='4'){
                       if(ch.charAt(j)!='6'){
                           test=false;
                       }
                   }else if(ch.charAt(i)=='6'){
                       if(ch.charAt(j)!='4'){
                           test=false;
                       }
                   }else if(ch.charAt(i)=='5'){
                       if(ch.charAt(j)!='9'){
                           test=false;
                       }
                   }else if(ch.charAt(i)=='9'){
                       if(ch.charAt(j)!='5'){
                           test=false;
                       }
                   }else if(ch.charAt(i)=='8'){
                       if(ch.charAt(j)!='0'){
                           test=false;
                       }
                   }else if(ch.charAt(i)=='0'){
                       if(ch.charAt(j)!='8'){
                           test=false;
                       }
                   }
                }
            }
            if(test){
                out.println("Yes");
            }else {
                out.println("No");
            }
        }
        out.close();
    }

    static class FastScanner {

        private BufferedReader in;
        private String[] line;
        private int index;
        private int size;

        public FastScanner(InputStream in) throws IOException {
            this.in = new BufferedReader(new InputStreamReader(in));
            init();
        }

        public FastScanner(String file) throws FileNotFoundException {
            this.in = new BufferedReader(new FileReader(file));
        }

        private void init() throws IOException {
            line = in.readLine().split(" ");
            index = 0;
            size = line.length;
        }

        public int nextInt() throws IOException {
            if (index == size) {
                init();
            }
            return Integer.parseInt(line[index++]);
        }

        public long nextLong() throws IOException {
            if (index == size) {
                init();
            }
            return Long.parseLong(line[index++]);
        }

        public float nextFloat() throws IOException {
            if (index == size) {
                init();
            }
            return Float.parseFloat(line[index++]);
        }

        public double nextDouble() throws IOException {
            if (index == size) {
                init();
            }
            return Double.parseDouble(line[index++]);
        }

        public String next() throws IOException {
            if (index == size) {
                init();
            }
            return line[index++];
        }

        public String nextLine() throws IOException {
            if (index == size) {
                init();
            }
            StringBuilder sb = new StringBuilder();
            for (int i = index; i < size; i++) {
                sb.append(line[i]).append(" ");
            }
            return sb.toString();
        }

        private int[] nextIntArray(int n) throws IOException {
            int[] tab = new int[n];
            for (int i = 0; i < tab.length; i++) {
                tab[i] = nextInt();
            }
            return tab;
        }

    }

}


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

public class Sqr {

    final boolean ONLINE_JUDGE = true;

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

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    void debug(Object o) {
        System.err.println(o.toString());
    }

    void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            debug("Time = " + (t2 - t1));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    int min(int x, int y) {
        if (x>=y)
        return y;
        else
        return x;
    }

    int max(int x, int y) {
        if (x>=y)
        return x;
        else
        return y;
    }

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

    void solve() throws IOException {
     int n = readInt();
     int x1 = readInt();
     int y1 = readInt();
     int x2 = readInt();
     int y2 = readInt();
     int s=0;
     if (abs(x1-x2)==n) s=3*n-(y1+y2);
     else
     if (abs(y1-y2)==n) s=3*n-(x1+x2);
     else
     s = max(x1,x2)-min(x1,x2)+max(y1,y2)-min(y1,y2);
     out.println(min(s,4*n-s);
    }

}