/*
 * Hello! You are trying to hack my solution, are you? =)
 * Don't be afraid of the size, it's just a dump of useful methods like gcd, or n-th Fib number.
 * And I'm just too lazy to create a new .java for every task.
 * And if you were successful to hack my solution, please, send me this test as a message or to Abrackadabraa@gmail.com.
 * It can help me improve my skills and i'd be very grateful for that.
 * Sorry for time you spent reading this message. =)
 * Good luck, unknown rival. =)
 * */

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

public class Abra {
	// double d = 2.2250738585072012e-308;
	void solve() throws IOException {
		 int n = nextInt(), t = nextInt();
		 TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>();
		 for (int i = 0; i < n; i++)
			 tm.put(nextInt(), nextInt());
		 double tx = -1e9;
		 int c = 2;
		 for (Map.Entry<Integer, Integer> m : tm.entrySet()) {
			 if (tx == -1e9) {
				 tx = m.getKey() + m.getValue() / 2.0 + t;
				 continue;
			 }
			 if (m.getKey() - m.getValue() / 2.0 >= tx) c++;
			 if (m.getKey() - m.getValue() / 2.0 > tx) c++;
			 tx = m.getKey() + m.getValue() / 2.0 + t;
		 }
		 out.print(c);
	}

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

	StreamTokenizer in;
	PrintWriter out;
	boolean oj;
	BufferedReader br;

	void init() throws IOException {
		oj = System.getProperty("ONLINE_JUDGE") != null;
		Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");
		Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");
		br = new BufferedReader(reader);
		in = new StreamTokenizer(br);
		out = new PrintWriter(writer);
	}

	long beginTime;

	void run() throws IOException {
		beginTime = System.currentTimeMillis();
		long beginMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
		init();
		solve();
		long endMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
		long endTime = System.currentTimeMillis();
		if (!oj) {
			System.out.println("Memory used = " + (endMem - beginMem));
			System.out.println("Total memory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
			System.out.println("Running time = " + (endTime - beginTime));
		}
		out.flush();
	}

	int nextInt() throws IOException {
		in.nextToken();
		return (int) in.nval;
	}

	long nextLong() throws IOException {
		in.nextToken();
		return (long) in.nval;
	}

	String nextString() throws IOException {
		in.nextToken();
		return in.sval;
	}

	double nextDouble() throws IOException {
		in.nextToken();
		return in.nval;
	}

	myLib lib = new myLib();

	void time() {
		System.out.print("It's ");
		System.out.println(System.currentTimeMillis() - beginTime);
	}

	static class myLib {
		long fact(long x) {
			long a = 1;
			for (long i = 2; i <= x; i++) {
				a *= i;
			}
			return a;
		}

		long digitSum(String x) {
			long a = 0;
			for (int i = 0; i < x.length(); i++) {
				a += x.charAt(i) - '0';
			}
			return a;
		}

		long digitSum(long x) {
			long a = 0;
			while (x > 0) {
				a += x % 10;
				x /= 10;
			}
			return a;
		}

		long digitMul(long x) {
			long a = 1;
			while (x > 0) {
				a *= x % 10;
				x /= 10;
			}
			return a;
		}

		int digitCubesSum(int x) {
			int a = 0;
			while (x > 0) {
				a += (x % 10) * (x % 10) * (x % 10);
				x /= 10;
			}
			return a;
		}

		double pif(double ax, double ay, double bx, double by) {
			return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
		}

		double pif3D(double ax, double ay, double az, double bx, double by, double bz) {
			return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by) + (az - bz) * (az - bz));
		}

		double pif3D(double[] a, double[] b) {
			return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2]));
		}

		long gcd(long a, long b) {
			if (a == 0 || b == 0) return 1;
			if (a < b) {
				long c = b;
				b = a;
				a = c;
			}
			while (a % b != 0) {
				a = a % b;
				if (a < b) {
					long c = b;
					b = a;
					a = c;
				}
			}
			return b;
		}

		int gcd(int a, int b) {
			if (a == 0 || b == 0) return 1;
			if (a < b) {
				int c = b;
				b = a;
				a = c;
			}
			while (a % b != 0) {
				a = a % b;
				if (a < b) {
					int c = b;
					b = a;
					a = c;
				}
			}
			return b;
		}

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

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

		int countOccurences(String x, String y) {
			int a = 0, i = 0;
			while (true) {
				i = y.indexOf(x);
				if (i == -1) break;
				a++;
				y = y.substring(i + 1);
			}
			return a;
		}

		int[] findPrimes(int x) {
			boolean[] forErato = new boolean[x - 1];
			List<Integer> t = new Vector<Integer>();
			int l = 0, j = 0;
			for (int i = 2; i < x; i++) {
				if (forErato[i - 2]) continue;
				t.add(i);
				l++;
				j = i * 2;
				while (j < x) {
					forErato[j - 2] = true;
					j += i;
				}
			}
			int[] primes = new int[l];
			Iterator<Integer> iterator = t.iterator();
			for (int i = 0; iterator.hasNext(); i++) {
				primes[i] = iterator.next().intValue();
			}
			return primes;
		}

		int rev(int x) {
			int a = 0;
			while (x > 0) {
				a = a * 10 + x % 10;
				x /= 10;
			}
			return a;
		}

		class myDate {
			int d, m, y;

			int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

			public myDate(int da, int ma, int ya) {
				d = da;
				m = ma;
				y = ya;
				if ((ma > 12 || ma < 1 || da > ml[ma - 1] || da < 1) && !(d == 29 && m == 2 && y % 4 == 0)) {
					d = 1;
					m = 1;
					y = 9999999;
				}
			}

			void incYear(int x) {
				for (int i = 0; i < x; i++) {
					y++;
					if (m == 2 && d == 29) {
						m = 3;
						d = 1;
						return;
					}
					if (m == 3 && d == 1) {
						if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {
							m = 2;
							d = 29;
						}
						return;
					}
				}
			}

			boolean less(myDate x) {
				if (y < x.y) return true;
				if (y > x.y) return false;
				if (m < x.m) return true;
				if (m > x.m) return false;
				if (d < x.d) return true;
				if (d > x.d) return false;
				return true;
			}

			void inc() {
				if ((d == 31) && (m == 12)) {
					y++;
					d = 1;
					m = 1;
				} else {
					if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {
						ml[1] = 29;
					}
					if (d == ml[m - 1]) {
						m++;
						d = 1;
					} else
						d++;
				}
			}
		}

		int partition(int n, int l, int m) {// n - sum, l - length, m - every
											// part
			// <= m
			if (n < l) return 0;
			if (n < l + 2) return 1;
			if (l == 1) return 1;
			int c = 0;
			for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {
				c += partition(n - i, l - 1, i);
			}
			return c;
		}

		int rifmQuality(String a, String b) {
			if (a.length() > b.length()) {
				String c = a;
				a = b;
				b = c;
			}
			int c = 0, d = b.length() - a.length();
			for (int i = a.length() - 1; i >= 0; i--) {
				if (a.charAt(i) == b.charAt(i + d)) c++;
				else
					break;
			}
			return c;
		}

		String numSym = "0123456789ABCDEF";

		String ZFromXToYNotation(int x, int y, String z) {
			if (z.equals("0")) return "0";
			String a = "";
			// long q = 0, t = 1;
			BigInteger q = BigInteger.ZERO, t = BigInteger.ONE;
			for (int i = z.length() - 1; i >= 0; i--) {
				q = q.add(t.multiply(BigInteger.valueOf(z.charAt(i) - 48)));
				t = t.multiply(BigInteger.valueOf(x));
			}
			while (q.compareTo(BigInteger.ZERO) == 1) {
				a = numSym.charAt((int) (q.mod(BigInteger.valueOf(y)).intValue())) + a;
				q = q.divide(BigInteger.valueOf(y));
			}
			return a;
		}

		double angleFromXY(int x, int y) {
			if ((x == 0) && (y > 0)) return Math.PI / 2;
			if ((x == 0) && (y < 0)) return -Math.PI / 2;
			if ((y == 0) && (x > 0)) return 0;
			if ((y == 0) && (x < 0)) return Math.PI;
			if (x > 0) return Math.atan((double) y / x);
			else {
				if (y > 0) return Math.atan((double) y / x) + Math.PI;
				else
					return Math.atan((double) y / x) - Math.PI;
			}
		}

		static boolean isNumber(String x) {
			try {
				Integer.parseInt(x);
			} catch (NumberFormatException ex) {
				return false;
			}
			return true;
		}

		static boolean stringContainsOf(String x, String c) {
			for (int i = 0; i < x.length(); i++) {
				if (c.indexOf(x.charAt(i)) == -1) return false;
			}
			return true;
		}

		long pow(long a, long n) { // b > 0
			if (n == 0) return 1;
			long k = n, b = 1, c = a;
			while (k != 0) {
				if (k % 2 == 0) {
					k /= 2;
					c *= c;
				} else {
					k--;
					b *= c;
				}
			}
			return b;
		}

		int pow(int a, int n) { // b > 0
			if (n == 0) return 1;
			int k = n, b = 1, c = a;
			while (k != 0) {
				if (k % 2 == 0) {
					k /= 2;
					c *= c;
				} else {
					k--;
					b *= c;
				}
			}
			return b;
		}

		double pow(double a, int n) { // b > 0
			if (n == 0) return 1;
			double k = n, b = 1, c = a;
			while (k != 0) {
				if (k % 2 == 0) {
					k /= 2;
					c *= c;
				} else {
					k--;
					b *= c;
				}
			}
			return b;
		}

		double log2(double x) {
			return Math.log(x) / Math.log(2);
		}

		int lpd(int[] primes, int x) {// least prime divisor
			int i;
			for (i = 0; primes[i] <= x / 2; i++) {
				if (x % primes[i] == 0) {
					return primes[i];
				}
			}
			;
			return x;
		}

		int np(int[] primes, int x) {// number of prime number
			for (int i = 0; true; i++) {
				if (primes[i] == x) return i;
			}
		}

		int[] dijkstra(int[][] map, int n, int s) {
			int[] p = new int[n];
			boolean[] b = new boolean[n];
			Arrays.fill(p, Integer.MAX_VALUE);
			p[s] = 0;
			b[s] = true;
			for (int i = 0; i < n; i++) {
				if (i != s) p[i] = map[s][i];
			}
			while (true) {
				int m = Integer.MAX_VALUE, mi = -1;
				for (int i = 0; i < n; i++) {
					if (!b[i] && (p[i] < m)) {
						mi = i;
						m = p[i];
					}
				}
				if (mi == -1) break;
				b[mi] = true;
				for (int i = 0; i < n; i++)
					if (p[mi] + map[mi][i] < p[i]) p[i] = p[mi] + map[mi][i];
			}
			return p;
		}

		boolean isLatinChar(char x) {
			if (((x >= 'a') && (x <= 'z')) || ((x >= 'A') && (x <= 'Z'))) return true;
			else
				return false;
		}

		boolean isBigLatinChar(char x) {
			if (x >= 'A' && x <= 'Z') return true;
			else
				return false;
		}

		boolean isSmallLatinChar(char x) {
			if (x >= 'a' && x <= 'z') return true;
			else
				return false;
		}

		boolean isDigitChar(char x) {
			if (x >= '0' && x <= '9') return true;
			else
				return false;
		}

		class NotANumberException extends Exception {
			private static final long serialVersionUID = 1L;
			String mistake;

			NotANumberException() {
				mistake = "Unknown.";
			}

			NotANumberException(String message) {
				mistake = message;
			}
		}

		class Real {
			String num = "0";
			long exp = 0;
			boolean pos = true;

			long length() {
				return num.length();
			}

			void check(String x) throws NotANumberException {
				if (!stringContainsOf(x, "0123456789+-.eE")) throw new NotANumberException("Illegal character.");
				long j = 0;
				for (long i = 0; i < x.length(); i++) {
					if ((x.charAt((int) i) == '-') || (x.charAt((int) i) == '+')) {
						if (j == 0) j = 1;
						else
							if (j == 5) j = 6;
							else
								throw new NotANumberException("Unexpected sign.");
					} else
						if ("0123456789".indexOf(x.charAt((int) i)) != -1) {
							if (j == 0) j = 2;
							else
								if (j == 1) j = 2;
								else
									if (j == 2)
									;
									else
										if (j == 3) j = 4;
										else
											if (j == 4)
											;
											else
												if (j == 5) j = 6;
												else
													if (j == 6)
													;
													else
														throw new NotANumberException("Unexpected digit.");
						} else
							if (x.charAt((int) i) == '.') {
								if (j == 0) j = 3;
								else
									if (j == 1) j = 3;
									else
										if (j == 2) j = 3;
										else
											throw new NotANumberException("Unexpected dot.");
							} else
								if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {
									if (j == 2) j = 5;
									else
										if (j == 4) j = 5;
										else
											throw new NotANumberException("Unexpected exponent.");
								} else
									throw new NotANumberException("O_o.");
				}
				if ((j == 0) || (j == 1) || (j == 3) || (j == 5)) throw new NotANumberException("Unexpected end.");
			}

			public Real(String x) throws NotANumberException {
				check(x);
				if (x.charAt(0) == '-') pos = false;
				long j = 0;
				String e = "";
				boolean epos = true;
				for (long i = 0; i < x.length(); i++) {
					if ("0123456789".indexOf(x.charAt((int) i)) != -1) {
						if (j == 0) num += x.charAt((int) i);
						if (j == 1) {
							num += x.charAt((int) i);
							exp--;
						}
						if (j == 2) e += x.charAt((int) i);
					}
					if (x.charAt((int) i) == '.') {
						if (j == 0) j = 1;
					}
					if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {
						j = 2;
						if (x.charAt((int) (i + 1)) == '-') epos = false;
					}
				}
				while ((num.length() > 1) && (num.charAt(0) == '0'))
					num = num.substring(1);
				while ((num.length() > 1) && (num.charAt(num.length() - 1) == '0')) {
					num = num.substring(0, num.length() - 1);
					exp++;
				}
				if (num.equals("0")) {
					exp = 0;
					pos = true;
					return;
				}
				while ((e.length() > 1) && (e.charAt(0) == '0'))
					e = e.substring(1);
				try {
					if (e != "") if (epos) exp += Long.parseLong(e);
					else
						exp -= Long.parseLong(e);
				} catch (NumberFormatException exc) {
					if (!epos) {
						num = "0";
						exp = 0;
						pos = true;
					} else {
						throw new NotANumberException("Too long exponent");
					}
				}
			}

			public Real() {
			}

			String toString(long mantissa) {
				String a = "", b = "";
				if (exp >= 0) {
					a = num;
					if (!pos) a = '-' + a;
					for (long i = 0; i < exp; i++)
						a += '0';
					for (long i = 0; i < mantissa; i++)
						b += '0';
					if (mantissa == 0) return a;
					else
						return a + "." + b;
				} else {
					if (exp + length() <= 0) {
						a = "0";
						if (mantissa == 0) {
							return a;
						}
						if (mantissa < -(exp + length() - 1)) {
							for (long i = 0; i < mantissa; i++)
								b += '0';
							return a + "." + b;
						} else {
							if (!pos) a = '-' + a;
							for (long i = 0; i < mantissa; i++)
								if (i < -(exp + length())) b += '0';
								else
									if (i + exp >= 0) b += '0';
									else
										b += num.charAt((int) (i + exp + length()));
							return a + "." + b;
						}
					} else {
						if (!pos) a = "-";
						for (long i = 0; i < exp + length(); i++)
							a += num.charAt((int) i);
						if (mantissa == 0) return a;
						for (long i = exp + length(); i < exp + length() + mantissa; i++)
							if (i < length()) b += num.charAt((int) i);
							else
								b += '0';
						return a + "." + b;
					}
				}
			}
		}

		boolean containsRepeats(int... num) {
			Set<Integer> s = new TreeSet<Integer>();
			for (int d : num)
				if (!s.contains(d)) s.add(d);
				else
					return true;
			return false;
		}

		int[] rotateDice(int[] a, int n) {
			int[] c = new int[6];
			if (n == 0) {
				c[0] = a[1];
				c[1] = a[5];
				c[2] = a[2];
				c[3] = a[0];
				c[4] = a[4];
				c[5] = a[3];
			}
			if (n == 1) {
				c[0] = a[2];
				c[1] = a[1];
				c[2] = a[5];
				c[3] = a[3];
				c[4] = a[0];
				c[5] = a[4];
			}
			if (n == 2) {
				c[0] = a[3];
				c[1] = a[0];
				c[2] = a[2];
				c[3] = a[5];
				c[4] = a[4];
				c[5] = a[1];
			}
			if (n == 3) {
				c[0] = a[4];
				c[1] = a[1];
				c[2] = a[0];
				c[3] = a[3];
				c[4] = a[5];
				c[5] = a[2];
			}
			if (n == 4) {
				c[0] = a[0];
				c[1] = a[2];
				c[2] = a[3];
				c[3] = a[4];
				c[4] = a[1];
				c[5] = a[5];
			}
			if (n == 5) {
				c[0] = a[0];
				c[1] = a[4];
				c[2] = a[1];
				c[3] = a[2];
				c[4] = a[3];
				c[5] = a[5];
			}
			return c;
		}

		int min(int... a) {
			int c = Integer.MAX_VALUE;
			for (int d : a)
				if (d < c) c = d;
			return c;
		}

		int max(int... a) {
			int c = Integer.MIN_VALUE;
			for (int d : a)
				if (d > c) c = d;
			return c;
		}

		int pos(int x) {
			if (x > 0) return x;
			else
				return 0;
		}

		long pos(long x) {
			if (x > 0) return x;
			else
				return 0;
		}

		double maxD(double... a) {
			double c = Double.MIN_VALUE;
			for (double d : a)
				if (d > c) c = d;
			return c;
		}

		double minD(double... a) {
			double c = Double.MAX_VALUE;
			for (double d : a)
				if (d < c) c = d;
			return c;
		}

		int[] normalizeDice(int[] a) {
			int[] c = a.clone();
			if (c[0] != 0) if (c[1] == 0) c = rotateDice(c, 0);
			else
				if (c[2] == 0) c = rotateDice(c, 1);
				else
					if (c[3] == 0) c = rotateDice(c, 2);
					else
						if (c[4] == 0) c = rotateDice(c, 3);
						else
							if (c[5] == 0) c = rotateDice(rotateDice(c, 0), 0);
			while (c[1] != min(c[1], c[2], c[3], c[4]))
				c = rotateDice(c, 4);
			return c;
		}

		boolean sameDice(int[] a, int[] b) {
			for (int i = 0; i < 6; i++)
				if (a[i] != b[i]) return false;
			return true;
		}

		final double goldenRatio = (1 + Math.sqrt(5)) / 2;
		final double aGoldenRatio = (1 - Math.sqrt(5)) / 2;

		long Fib(int n) {
			if (n < 0) if (n % 2 == 0) return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));
			else
				return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));
			return Math.round((pow(goldenRatio, n) - pow(aGoldenRatio, n)) / Math.sqrt(5));
		}

		class japaneeseComparator implements Comparator<String> {
			@Override
			public int compare(String a, String b) {
				int ai = 0, bi = 0;
				boolean m = false, ns = false;
				if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {
					if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') m = true;
					else
						return -1;
				}
				if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {
					if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') m = true;
					else
						return 1;
				}
				a += "!";
				b += "!";
				int na = 0, nb = 0;
				while (true) {
					if (a.charAt(ai) == '!') {
						if (b.charAt(bi) == '!') break;
						return -1;
					}
					if (b.charAt(bi) == '!') {
						return 1;
					}
					if (m) {
						int ab = -1, bb = -1;
						while (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {
							if (ab == -1) ab = ai;
							ai++;
						}
						while (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {
							if (bb == -1) bb = bi;
							bi++;
						}
						m = !m;
						if (ab == -1) {
							if (bb == -1) continue;
							else
								return 1;
						}
						if (bb == -1) return -1;
						while (a.charAt(ab) == '0' && ab + 1 != ai) {
							ab++;
							if (!ns) na++;
						}
						while (b.charAt(bb) == '0' && bb + 1 != bi) {
							bb++;
							if (!ns) nb++;
						}
						if (na != nb) ns = true;
						if (ai - ab < bi - bb) return -1;
						if (ai - ab > bi - bb) return 1;
						for (int i = 0; i < ai - ab; i++) {
							if (a.charAt(ab + i) < b.charAt(bb + i)) return -1;
							if (a.charAt(ab + i) > b.charAt(bb + i)) return 1;
						}
					} else {
						m = !m;
						while (true) {
							if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a' && b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') {
								if (a.charAt(ai) < b.charAt(bi)) return -1;
								if (a.charAt(ai) > b.charAt(bi)) return 1;
								ai++;
								bi++;
							} else
								if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a') return 1;
								else
									if (b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') return -1;
									else
										break;
						}
					}
				}
				if (na < nb) return 1;
				if (na > nb) return -1;
				return 0;
			}
		}

		Random random = new Random();
	}

	void readIntArray(int[] a) throws IOException {
		for (int i = 0; i < a.length; i++)
			a[i] = nextInt();
	}

	String readChars(int l) throws IOException {
		String r = "";
		for (int i = 0; i < l; i++)
			r += (char) br.read();
		return r;
	}

	class myFraction {
		long num = 0, den = 1;

		void reduce() {
			long d = lib.gcd(num, den);
			num /= d;
			den /= d;
		}

		myFraction(long ch, long zn) {
			num = ch;
			den = zn;
			reduce();
		}

		myFraction add(myFraction t) {
			long nd = lib.lcm(den, t.den);
			myFraction r = new myFraction(nd / den * num + nd / t.den * t.num, nd);
			r.reduce();
			return r;
		}

		public String toString() {
			return num + "/" + den;
		}
	}

	class myPoint {
		myPoint(int a, int b) {
			x = a;
			y = b;
		}

		int x, y;

		boolean equals(myPoint a) {
			if (x == a.x && y == a.y) return true;
			else
				return false;
		}

		public String toString() {
			return x + ":" + y;
		}
	}

	/*
	 * class cubeWithLetters { String consts = "ЧКТФЭЦ"; char[][] letters = { {
	 * 'А', 'Б', 'Г', 'В' }, { 'Д', 'Е', 'З', 'Ж' }, { 'И', 'Л', 'Н', 'М' }, {
	 * 'О', 'П', 'С', 'Р' }, { 'У', 'Х', 'Щ', 'Ш' }, { 'Ы', 'Ь', 'Я', 'Ю' } };
	 *
	 * char get(char x) { if (consts.indexOf(x) != -1) return x; for (int i = 0;
	 * i < 7; i++) { for (int j = 0; j < 4; j++) { if (letters[i][j] == x) { if
	 * (j == 0) return letters[i][3]; else return letters[i][j - 1]; } } }
	 * return '!'; }
	 *
	 * void subrotate(int x) { char t = letters[x][0]; letters[x][0] =
	 * letters[x][3]; letters[x][3] = letters[x][2]; letters[x][2] =
	 * letters[x][1]; letters[x][1] = t; }
	 *
	 * void rotate(int x) { subrotate(x); char t; if (x == 0) { t =
	 * letters[1][0]; letters[1][0] = letters[2][0]; letters[2][0] =
	 * letters[3][0]; letters[3][0] = letters[5][2]; letters[5][2] = t;
	 *
	 * t = letters[1][1]; letters[1][1] = letters[2][1]; letters[2][1] =
	 * letters[3][1]; letters[3][1] = letters[5][3]; letters[5][3] = t; } if (x
	 * == 1) { t = letters[2][0]; letters[2][0] = letters[0][0]; letters[0][0] =
	 * letters[5][0]; letters[5][0] = letters[4][0]; letters[4][0] = t;
	 *
	 * t = letters[2][3]; letters[2][3] = letters[0][3]; letters[0][3] =
	 * letters[5][3]; letters[5][3] = letters[4][3]; letters[4][3] = t; } if (x
	 * == 2) { t = letters[0][3]; letters[0][3] = letters[1][2]; letters[1][2] =
	 * letters[4][1]; letters[4][1] = letters[3][0]; letters[3][0] = t;
	 *
	 * t = letters[0][2]; letters[0][2] = letters[1][1]; letters[1][1] =
	 * letters[4][0]; letters[4][0] = letters[3][3]; letters[3][3] = t; } if (x
	 * == 3) { t = letters[2][1]; letters[2][1] = letters[4][1]; letters[4][1] =
	 * letters[5][1]; letters[5][1] = letters[0][1]; letters[0][1] = t;
	 *
	 * t = letters[2][2]; letters[2][2] = letters[4][2]; letters[4][2] =
	 * letters[5][2]; letters[5][2] = letters[0][2]; letters[0][2] = t; } if (x
	 * == 4) { t = letters[2][3]; letters[2][3] = letters[1][3]; letters[1][3] =
	 * letters[5][1]; letters[5][1] = letters[3][3]; letters[3][3] = t;
	 *
	 * t = letters[2][2]; letters[2][2] = letters[1][2]; letters[1][2] =
	 * letters[5][0]; letters[5][0] = letters[3][2]; letters[3][2] = t; } if (x
	 * == 5) { t = letters[4][3]; letters[4][3] = letters[1][0]; letters[1][0] =
	 * letters[0][1]; letters[0][1] = letters[3][2]; letters[3][2] = t;
	 *
	 * t = letters[4][2]; letters[4][2] = letters[1][3]; letters[1][3] =
	 * letters[0][0]; letters[0][0] = letters[3][1]; letters[3][1] = t; } }
	 *
	 * public String toString(){ return "  " + letters[0][0] + letters[0][1] +
	 * "\n" + "  " + letters[0][3] + letters[0][2] + "\n" + letters[1][0] +
	 * letters[1][1] + letters[2][0] + letters[2][1] + letters[3][0] +
	 * letters[3][1] + "\n" + letters[1][3] + letters[1][2] + letters[2][3] +
	 * letters[2][2] + letters[3][3] + letters[3][2] + "\n" + "  " +
	 * letters[4][0] + letters[4][1] + "\n" + "  " + letters[4][3] +
	 * letters[4][2] + "\n" + "  " + letters[5][0] + letters[5][1] + "\n" + "  "
	 * + letters[5][3] + letters[5][2] + "\n"; } }
	 *
	 *
	 * Vector<Integer>[] a; int n, mc, c1, c2; int[] col;
	 *
	 * void wave(int x, int p) { for (Iterator<Integer> i = a[x].iterator();
	 * i.hasNext(); ) { int t = i.next(); if (t == x || t == p) continue; if
	 * (col[t] == 0) { col[t] = mc; wave(t, x); } else { c1 = x; c2 = t; } } }
	 *
	 * void solve() throws IOException {
	 *
	 * String s = "ЕПОЕЬРИТСГХЖЗТЯПСТАПДСБИСТЧК"; //String s =
	 * "ЗЬУОЫТВЗТЯПУБОЫТЕАЫШХЯАТЧК"; cubeWithLetters cube = new
	 * cubeWithLetters(); for (int x = 0; x < 4; x++) { for (int y = x + 1; y <
	 * 5; y++) { for (int z = y + 1; z < 6; z++) { cube = new cubeWithLetters();
	 * out.println(cube.toString()); cube.rotate(x);
	 * out.println(cube.toString()); cube.rotate(y);
	 * out.println(cube.toString()); cube.rotate(z);
	 * out.println(cube.toString()); out.print(x + " " + y + " " + z + " = ");
	 * for (int i = 0; i < s.length(); i++) { out.print(cube.get(s.charAt(i)));
	 * } out.println(); } } }
	 *
	 * int a = nextInt(), b = nextInt(), x = nextInt(), y = nextInt();
	 * out.print((lib.min(a / (x / lib.gcd(x, y)), b / (y / lib.gcd(x, y))) * (x
	 * / lib.gcd(x, y))) + " " + (lib.min(a / (x / lib.gcd(x, y)), b / (y /
	 * lib.gcd(x, y))) * (y / lib.gcd(x, y)))); }
	 */

}


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

public class AA {

	static class Pair implements Comparable<Pair> {
		public int x, y;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
		public int compareTo(Pair p) {
			if (p.x != x)
				return x - p.x;
			return y - p.y;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int t = in.nextInt() * 2;
		List<Pair> l = new ArrayList<Pair>();
		for (int i = 0; i < n; i++) {
			int c = in.nextInt() * 2;
			int a = in.nextInt();
			l.add(new Pair(c - a, c + a));
		}
		Collections.sort(l);
		int ret = 2;
		for (int i = 1; i < n; i++) {
			if (l.get(i).x - l.get(i-1).y > t)
				ret += 2;
			else if (l.get(i).x - l.get(i-1).y == t)
				ret += 1;
		}
		System.out.println(ret);
	}

}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists()) {
				System.setIn(new FileInputStream("input.txt"));
			}
		} catch (SecurityException e) {
		}

		new Main().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		int N = nextInt();
		int T = nextInt();

		Pair[] p = new Pair [N];
		for (int i = 0; i < N; i++)
			p[i] = new Pair(nextInt(), nextInt());
		sort(p);
		int ans = 2;
		for (int i = 1; i < N; i++) {
			int dif = (2 * p[i].x - p[i].a) - (2 * p[i - 1].x + p[i - 1].a);
			if (dif == 2 * T)
				ans++;
			else if (dif > 2 * T)
				ans += 2;
		}
		out.println(ans);
		out.close();
	}

	class Pair implements Comparable<Pair> {
		int x, a;

		public Pair(int xx, int aa) {
			x = xx;
			a = aa;
		}

		@Override
		public int compareTo(Pair p) {
			return x < p.x ? -1 : 1;
		}
	}

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

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

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

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

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}


import java.io.BufferedReader;
import static java.lang.Math.*;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class CodeforcesA implements Runnable {
	public static final String taskname = "A";
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

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

	static class Square implements Comparable<Square>{
		int x, a;
		public Square(int x, int a) {
			this.x = x;
			this.a = a;
		}
		@Override
		public int compareTo(Square o) {
			return x - o.x;
		}

		int distance(Square a, int t) {
			double dist = a.x - x - this.a / 2.0 - a.a / 2.0;
			if(dist > t) return 2;
			else if(abs(dist - t) < 1e-9) return 1;
			return 0;
		}

		public String toString() {
			return x + " " + a;
		}
	}

	void solve() throws IOException {
		int n = nextInt(), t = nextInt();
		Square[] x = new Square[n];
		for(int i = 0; i < n; ++i) {
			x[i] = new Square(nextInt(), nextInt());
		}
		Arrays.sort(x);
		long res = 2;
		for(int i = 0; i < n - 1; ++i) {
			res += x[i].distance(x[i + 1], t);
		}
		out.println(res);

	}

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			//in = new BufferedReader(new FileReader(new File("input.txt")));
			 out = new PrintWriter(System.out);
			//out = new PrintWriter(new File("output.txt"));
			solve();
			out.flush();
			out.close();
			in.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	String nextLine() throws IOException {
		tok = null;
		return in.readLine();
	}

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

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

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

}


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

public class CottageVillage {

    class cl {
        int x=0;
        int a=0;

        cl(int x, int a){
            this.x=x;
            this.a=a;
        }
    }

    class cmp implements Comparator<cl> {
        public int compare(cl d1, cl d2) {
            return d1.x<d2.x ? -1 : 1;
        }
    }

    public CottageVillage() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        cl[] w = new cl[n];
        for(int i=0; i<n; i++)
            w[i] = new cl(sc.nextInt(), sc.nextInt());
        Arrays.sort(w, new cmp());

        int cnt=2, diff=0;
        for(int i=1; i<n; i++) {
            diff = Math.abs(2*w[i].x-2*w[i-1].x-w[i].a-w[i-1].a)-2*k;
            if (diff>0) cnt+=2;
            else if (diff==0) cnt++;
        }
        System.out.println(cnt);
    }

    public static void main(String... args) {
        new CottageVillage();
    }
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
public class A {
	public static void main(String[] args) throws IOException	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int t = Integer.parseInt(st.nextToken());
		State[] s = new State[n];
		for(int i = 0; i < n; i++)	{
			st = new StringTokenizer(br.readLine());
			s[i] = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
		}
		Arrays.sort(s);
		int num = 2;
		for(int i = 1; i < s.length; i++)	{
			int dist = s[i].x - s[i-1].x;
			dist *= 2;
			int size = s[i].d + s[i-1].d;
			size += 2 * t;
			if(dist == size)
				num++;
			else if(dist > size)
				num += 2;
		}
		System.out.println(num);
	}
	static class State implements Comparable<State> {
		public int x,d;
		public State(int a, int b)	{
			x=a;
			d=b;
		}
		public int compareTo(State s)	{
			return x - s.x;
		}
	}
}


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

public class Task15a {

	public static class House implements Comparable<House>{
		int x, s;

		public House(int x, int s) {
			super();
			this.x = x;
			this.s = s;
		}

		public int compareTo(House o) {
			return x - o.x;
		}

	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt() * 2;
		House[] hs = new House[n];
		for (int i = 0; i < n; i++){
			hs[i] = new House(sc.nextInt()*2, sc.nextInt());
		}
		Arrays.sort(hs);
		int res = 2;
		for (int i = 0; i < n - 1; i++) {
			int curr = hs[i+1].x - hs[i].x - hs[i+1].s - hs[i].s;
			if (curr > t) res += 2;
			if (curr == t) res += 1;
		}
		System.out.println(res);
	}

}


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

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

public class _P015A{
    Scanner sc=new Scanner(System.in);

    int INF=1<<28;
    double EPS=1e-9;

    int n, t;
    int[][] a;

    void run(){
        n=sc.nextInt();
        t=sc.nextInt();
        a=new int[n][2];
        for(int i=0; i<n; i++){
            a[i][0]=sc.nextInt();
            a[i][1]=sc.nextInt();
        }
        solve();
    }

    void solve(){
        sort(a, new Comparator<int[]>(){
            @Override
            public int compare(int[] a0, int[] a1){
                return a0[0]-a1[0];
            }
        });
        int ans=2;
        for(int i=0; i<n-1; i++){
            int s=(a[i+1][0]*2-a[i+1][1])-(a[i][0]*2+a[i][1]);
            if(s>t*2){
                ans+=2;
            }else if(s==t*2){
                ans++;
            }
        }
        println(ans+"");
    }

    void println(String s){
        System.out.println(s);
    }

    void print(String s){
        System.out.print(s);
    }

    void debug(Object... os){
        System.err.println(Arrays.deepToString(os));
    }

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


import java.util.*;

public class ProblemA {

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

		int n = s.nextInt();
		int t = s.nextInt();
		TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();

//		int x = 0 ;
		while(s.hasNextInt())
		{
			int i = s.nextInt();
			int j = s.nextInt();
			map.put(i,j);
//			x++;
//			if(x == 2)
//				break;
		}

		int count = 0;
		double left = -100000;
		double right;
		int size;
		for(Integer i : map.keySet())
		{
			size = map.get(i);
			right = (double)i - (double)size/2.0;

			if(right - left > t)
			{
				count+=2;
			}
			if(right - left == t)
			{
				count++;
			}

			left = (double)i + (double)size/2.0;
		}

		System.out.println(count);
	}

}


import java.util.*;

public class CottageVillage {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int size=sc.nextInt();
		int side=sc.nextInt();
		ArrayList<Pair> lis=new ArrayList<Pair>();
		for(int x=0;x<size;x++)
		{
			lis.add(new Pair(sc.nextInt(), sc.nextInt()));

		}
		Collections.sort(lis);
		int count=2;
		for(int x=0;x<lis.size()-1;x++)
		{
			Pair a=lis.get(x);
			Pair b=lis.get(x+1);
			double na=a.x+a.len/2;
			double nb=b.x-b.len/2;
			//System.out.println(na+" "+nb);
			if(na<nb)
			{
				double dif=Math.abs(nb-na);
				if(dif==side)count++;
				else if(dif>side)count+=2;
			}
		}
		System.out.println(count);
	}
}
class Pair implements Comparable<Pair>
{
	int x;
	double len;

	public Pair(int a,int b)
	{
		x=a;
		len=b;
	}
	public int compareTo(Pair o) {
		return x-o.x;
	}
}


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

public class Main {
//	static Scanner in;
	static PrintWriter out;
	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}

	public static void main(String[] args) throws Exception {
//		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

		int n = next();
		int t = 2*next();

		int[] x = new int[n];
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = 2* next() + 2000;
			a[i] = next();
		}

		int[] srt = new int[n];
		for (int i = 0; i < n; i++) srt[i] = 10000 * x[i] + a[i];
		Arrays.sort(srt);
		for (int i = 0; i < n; i++) {
			x[i] = srt[i] / 10000;
			a[i] = srt[i] % 10000;
		}

		int answ = 2;
		for (int i = 0; i < n - 1; i++) {
			if (x[i + 1] - x[i] > a[i] + a[i + 1] + t) answ++;
			if (x[i + 1] - x[i] >= a[i] + a[i + 1] + t) answ++;
		}

		out.println(answ);

		out.close();
	}
}


import java.util.*;

public class Beta15PA {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Beta15PA temp = new Beta15PA();
		temp.solve();
	}

	public void solve() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(), t = scan.nextInt();
		House[]	houses = new House[n];
		for(int i=0; i<n; i++) {
			houses[i] = new House(scan.nextInt(), scan.nextInt());
		}
		Arrays.sort(houses);
		int res = 2;
		for(int i=0; i<n-1; i++) {
			double cnt = houses[i+1].coordinate - houses[i].coordinate;
			cnt -= 1.0*(houses[i+1].side+houses[i].side)/2;
			if(cnt>t) res += 2;
			else if(Math.abs(cnt-t)<1e-7) res += 1;
		}
		System.out.println(res);
	}

	public class House implements Comparable<House> {
		public int coordinate, side;

		public House(int coordinate, int side) {
			this.coordinate = coordinate;
			this.side = side;
		}

		@Override
		public int compareTo(House arg0) {
			// TODO Auto-generated method stub
			return this.coordinate - arg0.coordinate;
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class ProblemA {

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

		String[] line = s.readLine().split(" ");
		int n = Integer.valueOf(line[0]);
		int ht = Integer.valueOf(line[1]);

		int[][] house = new int[n][2];
		Set<Integer> candidates = new HashSet<Integer>();
		for (int i = 0 ; i < n ; i++) {
			String[] data = s.readLine().split(" ");
			house[i][0] = Integer.valueOf(data[0]) * 2;
			house[i][1] = Integer.valueOf(data[1]);
			candidates.add(house[i][0] - house[i][1] - ht);
			candidates.add(house[i][0] + house[i][1] + ht);
		}

		int ans = 0;
		for (int p : candidates) {
			int f = p - ht;
			int t = p + ht;
			boolean isok = true;
			for (int i = 0 ; i < n ; i++) {
				if (house[i][0] + house[i][1] <= f) {
				} else if (house[i][0] - house[i][1] >= t) {
				} else {
					isok = false;
					break;
				}
			}
			if (isok) {
				ans++;
			}
		}

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

	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}


import java.io.*;
import java.util.Scanner;
import java.util.TreeMap;

/**
 *
 * @author camoroh13
 */
public class Solution {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
 //       Scanner sc = new Scanner(new FileInputStream("/home/camoroh13/NetBeansProjects/JavaApplication1/src/input.txt"));
        int n = sc.nextInt();
        int t = sc.nextInt();
//        int[][] h = new int[n][2];
        TreeMap<Integer, Integer> h = new TreeMap<Integer, Integer>();
        for (int i=0; i < n; i++) {
            int key = sc.nextInt();
            h.put(key, sc.nextInt());
        }

        int ans = 2;
        Integer lastKey = h.firstKey();
        Integer last = h.get(lastKey);
        h.remove(lastKey);
        for (int i=1; i < n; i++) {
            int key = h.firstKey();
            int val = h.get(key);
            //System.out.println(Math.abs(key-val*1.0/2 - (lastKey + last*1.0/2)) + "-" + key + "-"+val);
            if (Math.abs(key-val*1.0/2 - (lastKey + last*1.0/2)) == t) {
                ans++;
            } else if (Math.abs(key-val*1.0/2 - (lastKey + last*1.0/2))  > t) {
                ans += 2;
            }
            lastKey = key;
            last = val;
            h.remove(lastKey);
        }

        System.out.println(ans);

        sc.close();
    }

}


import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;

public class Solution15A {

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

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

        public static void main(String[] args){
                new Solution15A().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);
                }
        }

        static class Utils {

                private Utils() {}

                public static void mergeSort(int[] a) {
                        mergeSort(a, 0, a.length - 1);
                }

                private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
                        final int MAGIC_VALUE = 50;
                        if (leftIndex < rightIndex) {
                                if (rightIndex - leftIndex <= MAGIC_VALUE) {
                                        insertionSort(a, leftIndex, rightIndex);
                                } else {
                                        int middleIndex = (leftIndex + rightIndex) / 2;
                                        mergeSort(a, leftIndex, middleIndex);
                                        mergeSort(a, middleIndex + 1, rightIndex);
                                        merge(a, leftIndex, middleIndex, rightIndex);
                                }
                        }
                }

                private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
                        int length1 = middleIndex - leftIndex + 1;
                        int length2 = rightIndex - middleIndex;
                        int[] leftArray = new int[length1];
                        int[] rightArray = new int[length2];
                        System.arraycopy(a, leftIndex, leftArray, 0, length1);
                        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
                        for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
                                if (i == length1) {
                                        a[k] = rightArray[j++];
                                } else if (j == length2) {
                                        a[k] = leftArray[i++];
                                } else {
                                        a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
                                }
                        }
                }

                private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
                        for (int i = leftIndex + 1; i <= rightIndex; i++) {
                                int current = a[i];
                                int j = i - 1;
                                while (j >= leftIndex && a[j] > current) {
                                        a[j + 1] = a[j];
                                        j--;
                                }
                                a[j + 1] = current;
                        }
                }
        }

        class Square implements Comparable<Square>{
        	public Square(int x, int a){
        		this.x = x;
        		this.a = a;
        	}

        	@Override
			public int compareTo(Square o) {
				if(this.x > o.x) return 1;
				if(this.x < o.x) return -1;
				return 0;
			}

			public int a, x;
        }

        void solve() throws IOException{
        	int n = readInt();
        	int t = readInt();
        	Square[] houses = new Square[n];
        	for(int i = 0; i < n; i++){
        		int a = readInt();
        		int b = readInt();
        		houses[i] = new Square(a, b);
        	}
        	Arrays.sort(houses);
        	int count = 0;
        	for(int i = 0; i < n; i++){
        		if(i == 0) count++;
        		else{
        			if(houses[i].x - houses[i].a/2.0 - t > houses[i-1].x + houses[i-1].a/2.0)
        				count++;
        		}
        		if(i == n - 1) count++;
        		else{
        			if(houses[i].x + houses[i].a/2.0 + t <= houses[i+1].x - houses[i+1].a/2.0)
        				count++;
        		}
        	}
        	out.println(count);
        }

        static double distance(long x1, long y1, long x2, long y2){
        	return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        }

        static long gcd(long a, long b){
        	while(a != b){
        		if(a < b) a -=b;
        		else b -= a;
        	}
        	return a;
        }

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


import java.util.Scanner;

/**
 * @author Son-Huy TRAN
 *
 */
public class P15A_CottageVillage {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int t = scanner.nextInt();
		scanner.nextLine();

		int[] x = new int[n];
		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			x[i] = scanner.nextInt();
			a[i] = scanner.nextInt();
			scanner.nextLine();
		}

		scanner.close();

		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				if (x[i] > x[j]) {
					swap(x, i, j);
					swap(a, i, j);
				}
			}
		}

		int countPositions = 2;

		for (int i = 1; i < n; i++) {
			double left = x[i - 1] + a[i - 1] * 1.0 / 2;
			double right = x[i] - a[i] * 1.0 / 2;
			double length = right - left;

			if (length == (double) t) {
				countPositions++;
			} else if (length > t) {
				countPositions += 2;
			}
		}

		System.out.println(countPositions);
	}

	private static void swap(int[] numbers, int i, int j) {
		int temp = numbers[i];
		numbers[i] = numbers[j];
		numbers[j] = temp;
	}
}


import java.awt.Point;
import java.util.Arrays;
import java.util.Scanner;

public class p15a {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int t = in.nextInt();
        if(n == 1) {
            System.out.println(2);
            return;
        }
        house[] all = new house[n];
        for (int i = 0; i < all.length; i++) {
            all[i] = new house(in.nextInt(),in.nextInt());
        }
        Arrays.sort(all);

        int count = 0;
        for (int i = 0; i < all.length; i++) {
            double left = all[i].center - (all[i].side*1.0/2);
            double right = all[i].center + (all[i].side*1.0/2);
            if(i == 0) {
                count++;
                double left2 = all[i+1].center - (all[i+1].side*1.0/2);
                if(right+t<left2) {
                    count++;
                }
                continue;

            }
            if(i == all.length-1) {
                count++;
                double right2 = all[i-1].center + (all[i-1].side*1.0/2);
                if(left-t>= right2) {
                    count++;
                }
                continue;
            }
            double left2 = all[i+1].center - (all[i+1].side*1.0/2);
            double right2 = all[i-1].center + (all[i-1].side*1.0/2);

            if(right+t<left2) {
                count++;
            }
            if(left-t>=right2)
                count++;
        }
        System.out.println(count);

    }
}
class house implements Comparable<house>{
    int center;
    int side;
    public house(int a , int b) {
        center = a;
        side = b;
    }
    public int compareTo(house o) {
        return center-o.center;
    }
}


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

public class P015A {

    public static void main(String[] args) {
        Scanner inScanner = new Scanner(System.in);
        int n = inScanner.nextInt();
        int t = inScanner.nextInt();
        House[] houses = new House[n];
        for (int i = 0; i < n; i++)
            houses[i] = new House(inScanner.nextInt(), inScanner.nextInt());
        Arrays.sort(houses);
        int sum = 2;
        for (int i = 1; i < n; i++) {
            double space = houses[i].leftX - houses[i - 1].rightX;
            if (space >= t)
                sum++;
            if (space > t)
                sum++;
        }
        System.out.println(sum);
    }

    private static class House implements Comparable<House> {

        int x;
        double leftX;
        double rightX;

        public House(int x, int size) {
            super();
            this.x = x;
            leftX = x - (double) size / 2;
            rightX = x + (double) size / 2;
        }

        @Override
        public int compareTo(House o) {
            return x - o.x;
        }
    }
}


import java.util.Scanner;

public class A015 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), t = in.nextInt();
		int[] centers = new int[n], sides = new int[n];
		for (int x = 0; x < n; x++) {
			centers[x] = in.nextInt();
			sides[x] = in.nextInt();
		}
		int count = 0;

		big: for (int x = -4000; x <= 4000; x++) {
			boolean touch = false;
			for (int i = 0; i < n; i++) {
				int d = 2*centers[i] - x;
				d = d > 0 ? d : -d;
				int s = t + sides[i];
				if (s == d) {
					touch = true;
				} else if (s > d) {
					continue big;
				}
			}
			if (touch)
				count++;
		}
		System.out.println(count);
	}
}


import java.util.*;
public class Main {
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        double [] left = new double[n];
        double [] right = new double[n];
        for (int i = 0; i<n; i++){
            int x = sc.nextInt();
            int a = sc.nextInt();
            double l = x - (double)a/2;
            double r = x + (double)a/2;
            left[i] = l;
            right[i] = r;
        }
        int answer = 2;
        quickSort(left, right, 0, n-1);
        for (int i = 0; i<n-1; i++){
            if (left[i+1] - right[i] == t){
                answer++;
            }
            if (left[i+1] - right[i] > t){
                answer += 2;
            }
        }
        System.out.println(answer);
    }

////////////////////////////////////////////////////////////////
    int partition(double arr[], int left, int right)
    {
          int i = left, j = right;
          double tmp;
          double pivot = arr[(left + right) / 2];
          while (i <= j) {
                while (arr[i] < pivot)
                      i++;
                while (arr[j] > pivot)
                      j--;
                if (i <= j) {
                      tmp = arr[i];
                      arr[i] = arr[j];
                      arr[j] = tmp;
                      i++;
                      j--;
                }
          };
          return i;
    }
    void quickSort(double arr[], int left, int right) {
          int index = partition(arr, left, right);
          if (left < index - 1)
                quickSort(arr, left, index - 1);
          if (index < right)
                quickSort(arr,index, right);
    }
/////////////////////////////////////////////////////////////////////
    static int partition(double arr[], double arr2[], int left, int right)
    {
          int i = left, j = right;
          double tmp; double tmp2;
          double pivot = arr[(left + right) / 2];

          while (i <= j) {
                while (arr[i] < pivot)
                      i++;
                while (arr[j] > pivot)
                      j--;
                if (i <= j) {
                      tmp = arr[i];
                      arr[i] = arr[j];
                      arr[j] = tmp;
                      tmp2 = arr2[i];
                      arr2[i] = arr2[j];
                      arr2[j] = tmp2;
                      i++;
                      j--;
                }
          };
          return i;
    }
    static void quickSort(double arr[], double[]arr2, int left, int right) {
          int index = partition(arr, arr2, left, right);
          if (left < index - 1)
                quickSort(arr, arr2, left, index - 1);
          if (index < right)
                quickSort(arr, arr2, index, right);
    }
    ////////////////////////////////////////////////////////////////////////
}


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

public class CottageVillage {

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int counter = 0;
			int numbCottages = scan.nextInt();
			int t = scan.nextInt();
			House[] cottages = new House[numbCottages];
			for(int i =0; i<numbCottages; i++){
				int centre = scan.nextInt();
				int length = scan.nextInt();
				double beginning = centre - ((double)length)/2;
				double end = centre + ((double)length)/2;
				cottages[i]= new House(beginning, end);

			}

			Arrays.sort(cottages);

			//check righthand side of first cottage

			/*
			if(cottages[0].end + t < cottages[1].beginning)
				counter++;
			//check lefthand side of last cottage

			if(cottages[numbCottages-1].beginning -t > cottages[numbCottages-2].end)
				counter++;

				*/

			for(int i =0; i<numbCottages-1; i++){

				if(cottages[i].end + t <= cottages[i+1].beginning){
					counter++;
//					System.out.println(counter + "left hand");
				}

				if (cottages[i+1].beginning - t >= cottages[i].end){
					counter++;
//					System.out.println(counter + "right hand");
				}

				if (Math.abs((cottages[i].end + t - cottages[i+1].beginning)) < 1e-8){
					counter--;

				}

			}

			System.out.println(counter+2);

		}
	}

	static class House implements Comparable<House>{
		double beginning;
		double end;
		House(double _beginning, double _end){
			beginning = _beginning;
			end = _end;
		}
		@Override
		public int compareTo(House house) {
//			if(this.beginning<house.beginning){
//				return -1;
//			}
//			else if(this.beginning==house.beginning){
//				return 0;
//			}
//			else{
//				return 1;
//			}
			return Double.valueOf(beginning).compareTo(house.beginning);
		}

	}

}


import java.awt.Point;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author epiZend
 */
public class Cottage {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        List<Point> houses = new ArrayList<Point>();
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            int a = sc.nextInt();
            houses.add(new Point(x, a));
        }
        Collections.sort(houses, new Comparator<Point>() {

            @Override
            public int compare(Point o1, Point o2) {
                return ((Integer) o1.x).compareTo(o2.x);
            }
        });
        int pos = 2;
        for (int i = 0; i < n - 1; i++) {
            double end = houses.get(i).x + (houses.get(i).y+0.0)/2;
            double start = houses.get(i+1).x - (houses.get(i+1).y+0.0)/2;
            //System.out.println("end "+end+" start "+start);
            double diff = start-end;
            //System.out.println("diff");
            if (Math.abs(diff-t) < 0.0000001) {
                pos++;
            }
            if (diff > t) {
                pos += 2;
            }
        }
        System.out.println(pos);
    }
}


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

public class Solution {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    static class Pair implements Comparable<Pair> {
        int x, a;

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

        @Override
        public int compareTo(Pair o) {
            // TODO Auto-generated method stub
            return 0;
        }
    }

    boolean isCross(double l1, double r1, double l2, double r2) {
        double r = min(r1, r2);
        double l = max(l1, l2);
        return r > l;
    }

    boolean check(double xl, double xr, double[] l, double[] r, int n) {
        boolean ok = false;
        for (int j = 0; j < n; ++j)
            ok |= isCross(xl, xr, l[j], r[j]);
        return ok;
    }

    void solve() throws IOException {
        int n = ni();
        double t = ni();
        double[] l = new double[n];
        double[] r = new double[n];
        for (int i = 0; i < l.length; i++) {
            double x = ni();
            double len = ni();
            l[i] = x - len / 2.0;
            r[i] = x + len / 2.0;
        }
        HashSet<Double> set = new HashSet<Double>();
        for (int i = 0; i < n; ++i) {
            double xl = l[i] - t;
            double xr = l[i];
            boolean ok = check(xl, xr, l, r, n);
            if (!ok)
                set.add(xl);
            xl = r[i];
            xr = r[i] + t;
            ok = check(xl, xr, l, r, n);
            if (!ok)
                set.add(xl);

        }
        out.println(set.size());
    }

    public Solution() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

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

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

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


import java.util.*;

public class a {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		double w = in.nextDouble();
		int tot = 2;
		Interval[] houses = new Interval[n];
		for(int i=0; i<n; i++) {
			double center = in.nextDouble();
			double wid = in.nextDouble();
			houses[i] = new Interval(center-wid/2,center+wid/2);
		}
		Arrays.sort(houses);
		for(int i=1; i<n; i++) {
			double dist = houses[i].s - houses[i-1].e;
			if(dist+1e-6 >= w) {
				tot+=2;
				if(Math.abs(w-dist) < 1e-6)
					tot--;
			}
		}
		System.out.println(tot);
	}
}
class Interval implements Comparable<Interval> {
	double s, e;
	Interval(double a, double b) {
		s=a;
		e=b;
	}
	public int compareTo(Interval i) {
		return (int)Math.signum(s-i.s);
	}
}


import java.text.ChoiceFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		List<Double> coords = new ArrayList<Double>();
		while (n-- > 0) {
			double x = scan.nextDouble();
			double a = scan.nextDouble() / 2;
			coords.add(x - a);
			coords.add(x + a);
		}
		Collections.sort(coords);
		int count = 2;
		ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");
		for (int i = 1; i < coords.size()-2; i+=2) {
			count += new Integer(f.format(coords.get(i+1)-coords.get(i)-t));
		}
		System.out.println(count);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class A {
    BufferedReader in;
    StringTokenizer st;
    PrintWriter out;

    static class House implements Comparable<House> {
        final int x, a;

        House(int x, int a) {
            this.x = x;
            this.a = a;
        }

        public int compareTo(House h) {
            return x - h.x;
        }
    }

    void solve() throws IOException {
        int n = nextInt();
        int t = nextInt();
        House[] h = new House[n];
        for (int i = 0; i < n; ++i) {
            h[i] = new House(2 * nextInt(), nextInt());
        }
        Arrays.sort(h);
        int ans = 2;
        for (int i = 1; i < n; ++i) {
            House prev = h[i - 1];
            House curr = h[i];
            int diff = 2 * t + curr.a + prev.a;
            if (curr.x - prev.x == diff) {
                ++ans;
            } else if (curr.x - prev.x > diff) {
                ans += 2;
            }
        }
        out.println(ans);
    }

    public void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        eat("");
        solve();
        out.close();
        in.close();
    }

    void eat(String s) {
        st = new StringTokenizer(s);
    }

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            eat(line);
        }
        return st.nextToken();
    }

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

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

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

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


import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class R015A {
    final double EPS = 1e-9;
    boolean isEqual(double x, double y) {
        return Math.abs(x-y) <= EPS * Math.max(Math.abs(x), Math.abs(y));
    }
    class Pair implements Comparable<Pair>{
        double left;
        double right;
        Pair(double left, double right) {
            this.left = left;
            this.right = right;
        }
        public String toString() {
            return "(" + left + "," + right + ")";
        }
        public int hashCode() {
            return (int)(left * 17 + right * 31);
        }
        public boolean equals(Object o) {
            if(!(o instanceof Pair)) return false;
            Pair that = (Pair)o;
            return isEqual(this.left, that.left) && isEqual(this.right, that.right);
        }
        public int compareTo(Pair that) {
            if(this.left != that.left)
                return (int)(this.left - that.left);
            return (int)(this.right - that.right);
        }
    }
    public R015A() {
    }

    private void process() {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int t = scanner.nextInt();
        int[] x = new int[n];
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            x[i] = scanner.nextInt();
            a[i] = scanner.nextInt();
        }
        List<Pair> pairs = new ArrayList<Pair>();
        for(int i=0; i<n; i++) {
            double left = x[i] - a[i] / 2.0;
            double right= x[i] + a[i] / 2.0;
            pairs.add(new Pair(left, right));
        }
        Collections.sort(pairs);
        Set<Pair> newPairs = new HashSet<Pair>();
        newPairs.add(new Pair(pairs.get(0).left - t, pairs.get(0).left));
        for(int i=0; i<pairs.size()-1; i++) {
            if(pairs.get(i+1).left - pairs.get(i).right >= t) {
                newPairs.add(new Pair(pairs.get(i).right, pairs.get(i).right + t));
                newPairs.add(new Pair(pairs.get(i+1).left - t, pairs.get(i+1).left));
            }
        }
        newPairs.add(new Pair(pairs.get(pairs.size()-1).right, pairs.get(pairs.size()-1).right + t));
        System.out.println(newPairs.size());
    }

    public static void main(String[] args) {
        new R015A().process();
    }
}


import java.awt.Point;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class ProblemA {

    static ArrayList<Point2> houses = new ArrayList<Point2>();

    public static void main(String[] args) {
        ProblemA a = new ProblemA();
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int n = in.nextInt();
            double t = in.nextDouble();
            for (int k=0;k<n;k++){
                houses.add(a.new Point2(in.nextDouble(),in.nextDouble()));
            }
            Collections.sort(houses);
            int ans = 2;
            for (int k=0;k<n-1;k++){
                Point2 cur = houses.get(k);
                Point2 next = houses.get(k+1);
                double dist = (next.x - next.y/2) - (cur.x + cur.y/2);
                if (dist == t) ans ++;
                if (dist > t ) ans+=2;
            }
            System.out.println(ans);
        }
    }

    public class Point2 implements Comparable<Point2>{
        public double x;
        public double y;
        public Point2(double one, double two){
            x = one;
            y = two;
        }

        public int compareTo(Point2 other){
            if (x - other.x > 0) return 1;
            if (x - other.x < 0) return -1;
            return 0;
        }

        public String toString(){
            return "x:" + x + " y:" + y;
        }
    }
}


import java.util.*;

public class House {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		ArrayList<HS> list = new ArrayList<HS>();

		for (int i = 0; i < n; i++) {
			list.add(new HS(sc.nextInt(),sc.nextInt()));
		}

		Collections.sort(list);

		int count = 0;

		if(n >= 1)
			count = 2;

		for(int i = 0; i < list.size() - 1; i++){
			double d = Math.abs(list.get(i + 1).x - list.get(i).x);
			d -= ((1.0*list.get(i).a/2.0) + (1.0*list.get(i + 1).a/2.0));
			if ((d >= t)&& ((d-t) <= 0.00000001)){
				count++;
			}
			else if(d > t){
				count+= 2;
			}
		}
		System.out.println(count);
	}
}

class HS implements Comparable<HS> {
	public int x;
	public int a;

	public HS(int x, int a) {
		this.x = x;
		this.a = a;
	}

	public int compareTo(HS o) {
		return x - o.x;
	}

}


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

public class Main  {

    Scanner in;
    PrintWriter out;

    static class House implements Comparable <House>{
        int len;
        int pos;

        House(Scanner in){
            pos = in.nextInt() * 2;
            len = in.nextInt() * 2;
        }

        public int compareTo(House arg0) {
            return this.pos-arg0.pos;
        }

    }

    void solve(){
        int n = in.nextInt();
        int size = in.nextInt();
        House []h = new House[n];
        for (int i = 0; i < h.length; i++){
            h[i] = new House(in);
        }
        Arrays.sort(h);
        int ans = 2;
        for (int i = 0; i < h.length - 1; i++){
            int next = i + 1;
            int sz = h[next].pos - h[i].pos - (h[next].len + h[i].len) / 2;
            if (sz == size * 2) {
                ans ++;
            } else if (sz > size * 2) {
                ans += 2;
            }
        }
        out.println(ans);
    }

    public void run(){
        in = new Scanner(System.in);
        out = new PrintWriter(System.out);

        try {
            solve();
        } finally {
            out.close();
        }
    }

    void asserT(boolean e){
        if (!e){
            throw new Error();
        }
    }

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


import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class CottageVillage {

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

        int n = sc.nextInt();
        int k = sc.nextInt();

        TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>();
        while (n-->0) {
            tm.put(sc.nextInt(), sc.nextInt());
        }

        int cnt=2, x=0, a=0;
        double diff=0;
        for(Map.Entry<Integer, Integer> e : tm.entrySet()) {
            if (x!=0 || a!=0) {
                diff = Math.abs(e.getKey()-x-e.getValue()*0.5-a*0.5);
                if (diff-k>0) cnt+=2;
                else if (diff-k==0) cnt++;
            }
            x=e.getKey();
            a=e.getValue();
        }
        System.out.println(cnt);
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
    StreamTokenizer in;
    PrintWriter out;
    static public void main(String[] args) throws IOException {
        new Main().run();
    }
    int ni() throws IOException {
        in.nextToken(); return (int) in.nval;
    }
    void run() throws IOException {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));

        int n = ni(), t = ni();
        if(n == 0) {
            out.println(0); out.flush(); return;
        }
        House[] h = new House[n];
        for(int i = 0; i < n; i++) {
            h[i] = new House();
            h[i].x = ni(); h[i].a = ni();
        }
        Arrays.sort(h);
        int ret = 2;
        for(int i = 0; i < n - 1; i++) {
            if(2*(h[i + 1].x - h[i].x) - h[i].a - h[i + 1].a > 2*t) ret+=2;
            else if(2*(h[i + 1].x - h[i].x) - h[i].a - h[i + 1].a == 2*t) ret++;
        }
        out.println(ret);

        out.flush();
    }
    void run1() throws IOException {
            in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
            out = new PrintWriter(new OutputStreamWriter(System.out));

            int t = ni();
            long n = ni(), m = ni();
            long x1 = ni(), y1 = ni(), x2 = ni(), y2 = ni();
        long tx1 = Math.min(x1, x2), tx2 = x1 + x2 - tx1;
        long ty1 = Math.min(y1, y2), ty2 = y1 + y2 - ty1;
        long dx = tx2 - tx1;
        long dy = ty2 - ty1;

    }

    class House implements Comparable<House> {
        int x, a;
        public int compareTo(House h) {
            return x < h.x ? -1 : 1;
        }
    }
}


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

public class Solution {
    static class Cottage implements Comparable<Cottage> {
        public int x;
        public double a;

        public Cottage(int x, int a) {
            this.x = x;
            this.a = a;
        }

        public int compareTo(Cottage c) {
            return x - c.x;
        }
    }

    static final double e = 1e-9;

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

        int n = in.nextInt();
        int t = in.nextInt();
        Cottage[] cottages = new Cottage[n];

        for (int i = 0; i < n; i++)
            cottages[i] = new Cottage(in.nextInt(), in.nextInt());

        Arrays.sort(cottages);

        int ans = 2;

        for (int i = 1; i < cottages.length; i++) {
            double diff = cottages[i].x - cottages[i - 1].x - cottages[i - 1].a / 2 - cottages[i].a / 2;
            ans = Math.abs(diff - t) < e ? ans + 1 : diff - t < -e ? ans : ans + 2;
        }

        out.print(ans);
        out.close();
    }
}


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

/**
 * Created by HREN_VAM.
 */

public class A implements Runnable{

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;
    public static final String filename = "a";

    class I implements Comparable<I>{

        int x;
        int a;

        I(int x, int a){
            this.x = x;
            this.a = a;
        }

        public int compareTo(I o){
            return Double.compare(x, o.x);
        }
    }

    public void solve() throws IOException{
        int n = nextInt();
        int t = nextInt();

        I[] a = new I[n];

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

        int res = 2;

        Arrays.sort(a);
        for(int i = 1;i < n;i ++){
            if((a[i].x - a[i - 1].x - 1.0 * (a[i].a + a[i - 1].a) / 2) >= t)res ++;
            if((a[i].x - a[i - 1].x - 1.0 * (a[i].a + a[i - 1].a) / 2) > t)res ++;
        }
        out.println(res);
    }

    public void run(){
        try{
            Locale.setDefault(Locale.US);
            in = new BufferedReader(new InputStreamReader(System.in));
            //in = new BufferedReader(new FileReader(filename + ".in"));
            out = new PrintWriter(System.out);
            //out = new PrintWriter(new FileWriter(filename + ".out"));
            st = new StringTokenizer("");
            solve();
            out.close();
        } catch(IOException e){
            throw new RuntimeException(e);
        }
    }

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

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

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

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


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

public class Main implements Runnable {
    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer st;

    private void eat(String line)
    {
        st = new StringTokenizer(line);
    }

    private String next() throws IOException
    {
        while(!st.hasMoreTokens()) {
            String line = in.readLine();
            if(line == null)
                return null;
            eat(line);
        }
        return st.nextToken();
    }

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

    public void run()
    {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            eat("");

            go();

            out.close();
        } catch(Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

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

    public void go() throws IOException
    {
        int n = nextInt(), t = nextInt();
        int[] x = new int[n], a = new int[n];
        for(int i = 0; i < n; ++i) {
            x[i] = nextInt();
            a[i] = nextInt();
        }
        out.println(new Algo().solve(n, t, x, a));
    }
}

final class Algo {
    public int solve(int n, int t, final int[] x, final int[] a)
    {
        Integer[] order = new Integer[n];
        for(int i = 0; i < n; ++i)
            order[i] = i;
        Arrays.sort(order, new Comparator<Integer>() {
            public int compare(Integer a, Integer b)
            {
                return x[a] - x[b];
            }
        });
        int result = 2;
        for(int i = 0; i + 1 < n; ++i) {
            int u = order[i], v = order[i + 1];
            int dist = 2 * (x[v] - x[u]) - (a[v] + a[u]);
            if(dist > 2 * t)
                result += 2;
            else if(dist == 2 * t)
                ++result;
        }
        return result;
    }
}


import java.util.*;

public class Village{
	static class House implements Comparable<House>{
		public double center, length;

		public House(double center, double  length){
			this.center = center;
			this.length = length;
		}
		public double getRight(){
			return center + length/2;
		}
		public double getLeft(){
			return center - length/2;
		}
		public int compareTo(House h){
			return this.center < h.center ? -1 : this.center == h.center ? 0 : 1;
		}

	}
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] fline = in.nextLine().split("\\s+");
		int N = Integer.parseInt(fline[0]);
		int T = Integer.parseInt(fline[1]);

		House[] houses = new House[N];
		for (int i = 0; i < N; i++){
			String[] house = in.nextLine().split("\\s+");
			houses[i] = new House(Double.parseDouble(house[0]), Double.parseDouble(house[1]));
		}
		Arrays.sort(houses);
		int count = 2;
		for (int i = 0; i < houses.length - 1; i++){
			//how many positions between house i and house i + 1 can we fit in?
			double diff = houses[i+1].getLeft() - houses[i].getRight();
			if (diff < T) continue;
			if (Math.abs(diff - T) < 1E-12) count++;
			else count+=2;
		}
		System.out.println(count);
	}
}


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

public class Main {

	public Main() {
		super();
	}

	public static void main(String... args) {
		Main main = new Main();
		main.start();
	}

	public void start() {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int t = in.nextInt();
		House list[] = new House[n];
		for (int i = 0; i < n; i++) {
			int x = in.nextInt();
			int a = in.nextInt();
			list[i] = new House(x, a);
		}
		Arrays.sort(list);
		int c = 2;
		for (int i = 1; i < n; i++) {
			float d = list[i].left - list[i - 1].right;
			if (d == t) c++;
			else if (d > t) c += 2;
		}
		System.out.println(c);
	}
}

class House implements Comparable<House> {
	public int x;
	public float left, right;
	public House(int x, int a) {
		this.x = x;
		float h = a / 2f;
		this.left = x - h;
		this.right = x + h;
	}

	public int compareTo(House h) {
		return this.x == h.x ? 0 : this.x < h.x ? -1 : 1;
	}

}


import java.util.*;
import java.awt.*;

public class A
{
	static Comparator<Point> cmp = new Comparator<Point>()
	{
		public int compare(Point a, Point b)
		{
			if(a.x < b.x)
				return -1;
			else if(a.x > b.x)
				return 1;

			return 0;
		}
	};

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

		while(scan.hasNextInt())
		{

		int n = scan.nextInt();
		int k = scan.nextInt();

		Point[] a = new Point[n];

		for(int i=0;i < n;i++)
		{
			a[i] = new Point();
			a[i].x = scan.nextInt();
			a[i].y = scan.nextInt();
		}

		Arrays.sort(a, cmp);

		int rtn = 0;

		ArrayList<Double> ans = new ArrayList<Double>();

		for(int i=0;i < n;i++)
		{
			//Left
			double lb = a[i].x - (a[i].y / 2.0) - k;
			double pos = lb + (k/2.0);
			boolean good = true;

			for(int j=0;j < ans.size();j++)
				if(Math.abs(ans.get(j) - pos) < 0.0000001)
					good = false;

			if(good && (i == 0 || a[i-1].x + (a[i-1].y / 2.0) <= lb))
			{
				rtn++;
				ans.add(pos);
			}

			double rb = a[i].x + (a[i].y / 2.0) + k;
			pos = rb - (k/2.0);
			good = true;

			for(int j=0;j < ans.size();j++)
				if(Math.abs(ans.get(j) - pos) < 0.0000001)
					good = false;

			if(good && (i == n-1 || a[i+1].x - (a[i+1].y / 2.0) >= rb))
			{
				rtn++;
				ans.add(pos);
			}
		}

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


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

public class Main implements Runnable {

	class Segment {
		int l, r;
		Segment(int l, int r) {
			this.l = l;
			this.r = r;
		}
		@Override
		public boolean equals(Object obj) {
			Segment o = (Segment)obj;
			return l == o.l && r == o.r;
		}
		@Override
		public int hashCode() {
			return 1000 * l + r;
		}
	}

	public void _main() throws IOException {
		int n = nextInt();
		int t = nextInt();
		int[] x = new int[n];
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = nextInt();
			a[i] = nextInt();
		}
		Set<Segment> set = new HashSet<Segment>();
		for (int i = 0; i < n; i++) {
			int l = 2 * x[i] + a[i];
			int r = 2 * x[i] + a[i] + 2 * t;
			boolean ok = true;
			for (int j = 0; j < n; j++) {
				if (i == j) continue;
				int L = Math.max(l, 2 * x[j] - a[j]);
				int R = Math.min(r, 2 * x[j] + a[j]);
				if (L < R) {
					ok = false;
					break;
				}
			}
			if (ok)
				set.add(new Segment(l, r));

			l = 2 * x[i] - a[i] - 2 * t;
			r = 2 * x[i] - a[i];
			ok = true;
			for (int j = 0; j < n; j++) {
				if (i == j) continue;
				int L = Math.max(l, 2 * x[j] - a[j]);
				int R = Math.min(r, 2 * x[j] + a[j]);
				if (L < R) {
					ok = false;
					break;
				}
			}
			if (ok)
				set.add(new Segment(l, r));
		}
		out.print(set.size());
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

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

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

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

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

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}


import java.util.*;

public class test
{
    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int t=in.nextInt();

        House[] houses=new House[n];

        for(int i=0;i<n;i++)
        {
            houses[i]=new House(in.nextInt(),in.nextInt());
        }

        Arrays.sort(houses);

        int count=2;

        for(int i=0;i<n-1;i++)
        {
            double start=houses[i].x+(double)houses[i].a/2;
            double end=houses[i+1].x-(double)houses[i+1].a/2;

            if(end-start==t)
        	count++;
            if(end-start>t)
        	count+=2;
        }

        System.out.println(count);

    }
}

class House implements Comparable<House>
{
    int x;
    int a;

    public House(int _x, int _a)
    {
	x=_x;
	a=_a;
    }

    @Override
    public int compareTo(House o) {
	return x-o.x;
    }

}


import java.util.*;

/**
 * @author Alexander Grigoryev
 *         Created on 28.07.2011
 */
public
class Main {
    static Scanner in = new Scanner(System.in);

    public static
    void main(String[] args) {
        int n = in.nextInt();
        int t = in.nextInt();

        List<Integer> v = new ArrayList<Integer>(n);
        for(int i = 0; i < n; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            v.add(2 * a - b);
            v.add(2 * a + b);
        }
        Collections.sort(v);
        int ans = 2;
        for(int i = 2; i < v.size(); i += 2) {
            if(v.get(i) - v.get(i - 1) > 2 * t) ans += 2;
            if(v.get(i) - v.get(i - 1) == 2 * t) ans++;
        }
        System.out.println(ans);
    }
}


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

public class Village
{
	static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );

	public static void main( String[] args )
	{
		int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;
		for( int i = 0; i < n; i++ )
		{
			h[i][0] = 2*in.nextInt();
			h[i][1] = in.nextInt();
		}
		Arrays.sort( h, new Comp() );
		for( int i = 1; i < n; i++ )
		{
			int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);
			if( d > t ) ans += 2;
			else if( d == t ) ans++;
		}
		System.out.println( ans );
	}

	static class Comp implements Comparator<int[]> { public int compare( int[] a, int[] b ) { return a[0]-b[0]; } }
}


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

/**
 *
 */

/**
 * @author burdakovd
 *
 */
public class A {

	static class House {
		int x, a;
	}

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

		try {
			final int n = in.nextInt();
			final int t = in.nextInt();

			final House[] h = new House[n];
			for (int i = 0; i < h.length; ++i) {
				h[i] = new House();
				h[i].x = in.nextInt();
				h[i].a = in.nextInt();
			}

			Arrays.sort(h, new Comparator<House>() {

				@Override
				public int compare(final House o1, final House o2) {
					return Integer.valueOf(o1.x).compareTo(o2.x);
				}
			});

			int ans = 2;
			for (int i = 1; i < n; ++i) {
				final int dspace = 2 * h[i].x - h[i].a
						- (2 * h[i - 1].x + h[i - 1].a);
				if (dspace == 2 * t) {
					++ans;
				} else if (dspace > 2 * t) {
					ans += 2;
				}
			}

			out.println(ans);

		} finally {
			in.close();
			out.close();
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
	private static StreamTokenizer in;
	private static PrintWriter out;

	private static int nextInt() throws Exception {
		in.nextToken();
		return (int)in.nval;
	}

	private static String nextString() throws Exception {
		in.nextToken();
		return in.sval;
	}

	public static void main(String[] args) throws Exception {
		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		out = new PrintWriter(System.out);

		int n = nextInt(), t = nextInt() * 2;
		int[][] a = new int[n][2];
		for (int i=0; i<n; i++) {
			a[i][0] = nextInt() * 2;
			a[i][1] = nextInt() * 2;
		}

		Arrays.sort(a, new Comparator<int[]>() {
			public int compare(int[] a, int[] b) {
				return a[0]>b[0]?1:a[1]<b[1]?-1:0;
			}
		});

		int s = 2;

		for (int i=0; i<n-1; i++) {
			int g = (a[i+1][0]-a[i][0])-(a[i+1][1]+a[i][1])/2;
			if (g > t) s += 2;
			if (g == t) s+= 1;
		}
		out.println(s);

		out.flush();
	}
}


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

public class A {

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

			String[] s = in.readLine().split(" ");
			int n = Integer.parseInt(s[0]);
			int t = Integer.parseInt(s[1]) * 2;

			int[] walls = new int[n*2];

			for (int i=0; i<n; i++)
			{
				s = in.readLine().split(" ");
				int x = Integer.parseInt(s[0]) * 2;
				int a = Integer.parseInt(s[1]);
				walls[i*2] = x-a;
				walls[i*2+1] = x+a;
			}

			Arrays.sort(walls);

			int count = 2;

			for (int i=1; i<n*2-2; i+=2) {
				int space = walls[i+1] - walls[i];
				if ( space == t)
					count += 1;
				else if ( space > t)
					count += 2;
			}

			System.out.println (count);

		} catch (NumberFormatException e) {
			throw new RuntimeException(e);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}

	}
}


import java.util.*;

public class village {
    static int[] X, A;
    public void solve()
    {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(), T = in.nextInt();
        X = new int[N];
        A = new int[N];

        for(int i = 0; i < N; i++) {
            X[i] = in.nextInt(); A[i] = in.nextInt();
        }

        if(N == 1) {
            System.out.println("2");
            return;
        }

        List<Integer> x = new ArrayList<Integer>();
        for(int i = 0; i < N; i++) {
            x.add(i);
        }

        Collections.sort(x, new Comp());

        int places = 0;
        for(int i = 0; i < N-1; i++) {
            double space = (X[x.get(i+1)]-X[x.get(i)]-A[x.get(i+1)]/2.0-A[x.get(i)]/2.0);
            if(space < T) {
                continue;
            } if(space - T < 1e-9) {
                places++;
            } else if(space > T) {
                places+=2;
            }
        }
        System.out.println(places+2);
    }

    public class Comp implements Comparator<Integer> {
            public int compare(Integer i1, Integer i2) {
                return X[i1]-X[i2];
            }
    }

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


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

public class A implements Runnable
{
	public static void main(String [] args) throws IOException
	{
		new Thread(null, new A(), "", 1 << 20).start();
	}

	String file = "input";
	BufferedReader input;
	PrintWriter out;

	public void run()
	{
		try
		{
			//input = new BufferedReader(new FileReader(file + ".in"));
			input = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new BufferedOutputStream(System.out));
			solve();
			input.close();
			out.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
			System.exit(1);
		}
	}
	int N, T;
	void solve() throws IOException
	{
		StringTokenizer st = tokens();
		N = nextInt(st); T = nextInt(st);
		T *= 2;
		ArrayList<Pair> list = new ArrayList<Pair>();
		for(int i = 0; i < N; i++)
		{
			st = tokens();
			int c = nextInt(st), L = nextInt(st);
			c *= 2; L *= 2;
			list.add(new Pair(c - L / 2, c + L / 2));
		}
		Collections.sort(list);
		HashSet<Integer> set = new HashSet<Integer>();
		for(int i = 0; i < list.size(); i++)
		{
			if(i == 0 || list.get(i).x - list.get(i - 1).y >= T)
			{
				set.add(list.get(i).x - T / 2);
			}
			if(i == list.size() - 1 || list.get(i + 1).x - list.get(i).y >= T)
			{
				set.add(list.get(i).y + T / 2);
			}
		}
		System.out.println(set.size());
	}
	class Pair implements Comparable<Pair>
	{
		int x, y;
		public Pair(int x, int y)
		{
			this.x = x;
			this.y = y;
		}
		public int compareTo(Pair p)
		{
			if(x != p.x) return x - p.x;
			return y - p.y;
		}
	}

	StringTokenizer tokens() throws IOException
	{
		return new StringTokenizer(input.readLine());
	}

	String next(StringTokenizer st)
	{
		return st.nextToken();
	}

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

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

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

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

	void print(Object... o)
	{
		out.println(deepToString(o));
	}
}


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

public class A {
    static class Sort implements Comparable<Sort> {
        int x,a;
        public int compareTo(Sort o) {
            if (this.x==o.x)
                return this.a-o.a;
            return this.x-o.x;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        Sort[]a = new Sort[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Sort();
            a[i].x = sc.nextInt();
            a[i].a = sc.nextInt();
        }
        Arrays.sort(a);
        int ans = 2;
        for (int i = 1; i < n; i++) {
            double d = a[i].x-a[i].a / 2.0-a[i-1].x-a[i-1].a / 2.0;
            if (d==t)
                ans++;
            else if (d > t)
                ans += 2;
        }
        System.out.println(ans);
    }
}


import java.security.KeyException;
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeMap;

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

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt(), t = scan.nextInt();

        TreeMap<Integer,Integer> hm = new TreeMap<Integer, Integer>();

        for (int i = 0; i < n; i++) hm.put(scan.nextInt(),scan.nextInt());

        int _x = 0, _a = 0, res = 2;

        boolean started = false;

        for (Integer key : hm.keySet())
        {

            if (!started)
            {
                _x = key;
                _a = hm.get(_x);
                started = true;
                continue;
            }

            if (key - _x - ((Integer)hm.get(key) + _a)/2.0 > t) res +=2;
            else if (key - _x - ((Integer)hm.get(key) + _a)/2.0 == t) res++;

            _x = key;
            _a = hm.get(_x);

        }

        System.out.println(res);

    }

}


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

public class A {
    static InputStreamReader in = new InputStreamReader(System.in);
    static BufferedReader bf = new BufferedReader(in);
    static StreamTokenizer st = new StreamTokenizer(bf);
    static Scanner sc = new Scanner(System.in);

    static class Sort implements Comparable<Sort> {
        int x, a;

        public int compareTo(Sort arg0) {
            if (this.x > arg0.x)
                return 1;
            return 0;
        }
    }

    public static void main(String[] args) throws IOException {
        int n = nextInt();
        double t = nextInt();
        Sort[] p = new Sort[n];

        for (int i = 0; i < n; i++) {
            p[i] = new Sort();
            p[i].x = nextInt();
            p[i].a = nextInt();
        }
        int ans = 2;
        Arrays.sort(p);
        for (int i = 1; i < p.length; i++) {
            double k = p[i].x - p[i].a / 2.0 - p[i - 1].x - p[i - 1].a / 2.0;
            if (t == k)
                ans++;
            else if (k > t)
                ans += 2;
        }
        System.out.println(ans);
    }

    private static String nextString() throws IOException {
        st.nextToken();
        return st.sval;
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

}


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

public class CottageVillage
{
	public Scanner in = new Scanner(System.in);
	public PrintStream out = System.out;

	public int n, t;
	public Pair[] v;

	public void main()
	{
		n = in.nextInt();
		t = in.nextInt();

		int i;
		v = new Pair[n];
		for(i=0;i<n;++i) v[i] = new Pair(in.nextInt() * 2, in.nextInt());

		Arrays.sort(v);

		int res = 2;
		for(i=0;i+1<n;++i)
		{
			if(v[i].x + v[i].y + 2*t == v[i+1].x - v[i+1].y) ++res;
			else if(v[i].x+v[i].y+2*t < v[i+1].x-v[i+1].y) res +=2;
		}

		out.println(res);
	}//end public void main()

	//int pair
	private class Pair implements Comparable<Pair>
	{
		public int x, y;
		public Pair(int xx, int yy) { x = xx; y = yy; }

		public int compareTo(Pair u)
		{
			if(x!=u.x) return x-u.x;
			return y-u.y;
		}

		public String toString() { return "(" + x + "," + y + ")"; }
	}

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


import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.Arrays;
import java.util.Scanner;

public class A
{

	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int t=in.nextInt();
		pt[] P=new pt[n];
		for (int i=0; i<n; ++i)
			P[i]=new pt(in.nextInt(), in.nextInt());
		Arrays.sort(P);
		int res=2;
		for (int i=0; i+1<n; ++i)
		{
			double d=P[i+1].x-P[i].x-P[i+1].a/2.-P[i].a/2.;
			if (Math.abs(d-t) <= 1e-11)
				++res;
			else if (d>t)
				res+=2;
		}
		System.out.println(res);
	}

}

class pt implements Comparable<pt>
{
	int x,a;
	pt(int x, int a)
	{
		this.x=x;
		this.a=a;
	}

	public int compareTo(pt o)
	{
		return x-o.x;
	}
}


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

public class a {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int[][] xa = new int[n][2];
		for(int i=0; i<n; ++i) {
			xa[i][0] = sc.nextInt();
			xa[i][1] = sc.nextInt();
		}
	    Arrays.sort(xa, new Comparator<int[]>(){
            @Override
            public int compare(int[] a0, int[] a1){
                return a0[0]-a1[0];
            }
        });
		  int ans=2;
	        for(int i=0; i<n-1; i++){
	            int s=(xa[i+1][0]*2-xa[i+1][1])-(xa[i][0]*2+xa[i][1]);
	            if(s>t*2){
	                ans+=2;
	            }else if(s==t*2){
	                ans++;
	            }
	        }
	        System.out.println(ans+"");
	}
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import static java.lang.System.out;

public class Flatville
{
    public static void main( String args[] )
    {
        class SquareHouse implements Comparable<SquareHouse>
        {
            public SquareHouse( double posLeft, double sideLen )
            {
                _posLeft = posLeft;
                _sideLen = sideLen;
            }

            public double posLeft()
            { return _posLeft; }

            public double posRight()
            { return _posLeft + _sideLen; }

            public int compareTo( SquareHouse house )
            {
                double dist = _posLeft - house.posLeft();
                if ( dist < 0 )
                    return -1;
                else if ( dist > 0 )
                    return 1;
                else return 0;
            }

            private double _posLeft;
            private double _sideLen;
        }

        Scanner scanner = new Scanner( System.in );

        // Read the header
        final int nHouses    = scanner.nextInt();
        final double sideLen = scanner.nextDouble();

        ArrayList<SquareHouse> houses = new ArrayList<SquareHouse>();

        // Read the houses
        for ( int iHouse = 0; iHouse < nHouses; ++iHouse )
        {
            double pos  = scanner.nextDouble();
            double size = scanner.nextDouble();
            double posLeft = pos - size / 2.0;
            houses.add( new SquareHouse( posLeft, size ) );
        }

        // Sort the houses
        Collections.sort( houses );

        int nPositions = 2;
        for ( int iHouse = 0; iHouse < nHouses - 1; ++iHouse )
        {
            double space = houses.get( iHouse + 1 ).posLeft() - houses.get( iHouse ).posRight();
            if ( sideLen < space )
                nPositions += 2;
            else if ( sideLen == space )
                nPositions++;
        }

        out.println( nPositions );
    }
}