var inp = readline().split(" ").map(function(x){return parseInt(x);});
var m = inp[0];
var s = inp[1];
var sMin = s;
var sMax = s;

var numberMin = "";
var numberMax = "";
var sum = 0;
var min = -1;
var max = -1;

if (s == 0){
	if (m == 1){
		print("0 0");
	}else{
		print("-1 -1");
	}
} else {
	if (s > m * 9){
		print("-1 -1");
	} else
	{
		var k = 1;

		for(var i=m; i > 0; i--){
			function getMin(){
				if (i==m){
					return Math.min(Math.max(1, sMin - (i-1) * 9), 9);
				} else
				{
					return Math.min(Math.max(0, sMin - (i-1) * 9), 9);
				}
			}

			function getMax(){
				return Math.min(Math.max(sMax - (i-1) * 9, 9), sMax);
			}

			min = getMin();
			numberMin += min;
			sMin -= min;

			max = getMax();
			numberMax += max;
			sMax -= max;
		}

		print(numberMin + " " + numberMax);
	}
}

'use strict'

const fn = (M, S) => {
    if (S === 0) return M === 1 ? '0 0' : '-1 -1'
    if (S > 9 * M) return '-1 -1'
    const s = (S - 1) % 9 + 1;
    const len9 = (S - s) / 9;
    const r = '9'.repeat(len9);
    if (M - 1 === len9) return `${s}${r} ${r}${s}`;
    const z = '0'.repeat(M - 2 - len9);
    return `1${z}${s-1}${r} ${r}${s}${z}0`;
}
const x = readline().split(' ');
write(fn(parseInt(x[0]), parseInt(x[1])));

var x = readline(),a=x.substring(0,x.indexOf(' ')), n = Number.parseInt(a),
            m =Number.parseInt(x.substring(x.indexOf(' ')+1,x.length)),h=m
            ,min = "", max = ""
            var ok = true,ok2=true
            if (n > 1 && m === 0) {
                print("-1 -1")
            } else if (m > n * 9) {
                print("-1 -1")
            } else {
                for (var i = 0; i < n; ++i) {
                    if (h - 9 > 0) {
                        min += "9"
                        max += "9"
                        h -= 9
                    } else {
                        if (ok) {
                            max += h
                            ok = false
                        }
                        else
                            max += "0"
                        if (ok2){
                            if (i===n-1)min=h+min
                            else min=(h-1)+min
                            ok2=false
                        }else{
                             if(i===n-1)min="1"+min
                             else min="0"+min
                        }
                    }
                }
            }
            print(min + " " + max)

var inp = readline().split(' ');
var m = parseInt(inp[0]);
var s = parseInt(inp[1]);

var largestArr = [], smallestArr = [1];
for (var i = 0; i < m; i ++) {
	largestArr.push(0);
	if (i !== 0) smallestArr.push(0);
}
if (s === 0) smallestArr[0] = 0;

var largestOn = 0, smallestOn = m - 1;
for (var i = 0; i < s; i ++) {
	if (largestOn < m) {
		largestArr[largestOn] ++;
		if (largestArr[largestOn] === 9) largestOn ++;
	} else largestArr = [-1];

	if (smallestOn >= 0) {
		if (i >= 1) {
			smallestArr[smallestOn] ++;
			if (smallestArr[smallestOn] === 9) smallestOn --;
		}
	} else smallestArr = largestArr[0] !== -1 ? largestArr : [-1];
}

print(s === 0 && m !== 1 ? '-1 -1' : smallestArr.join('') + ' ' + largestArr.join(''));

var enter = readline().split(' ');
var n = enter[0];
var s = enter[1];
if(s <= n * 9 && s != 0 || s == 0 && n == 1) {
	var get_max = function(n,s) {
  var max = '';
  	while(n--) {
  		if( s >= 9) {
    max += 9;
    s -= 9;
    } else {
    max += s;
		s = 0;
    }
  }
  return max;
  };
  	var get_min = function(n,s) {
  	var first = true;
  	var min = '';
  		while(n--) {
  		var mn = first && n ? 1 : 0;
		var cur = Math.max(mn, s-9*n);
		s -= cur;
		min += cur;
		first = false;
  }
  return min;
  };
  print(get_min(n, s), get_max(n, s));
} else {
	print(-1, -1);
}

'use strict';

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let input = readline().getNumArray();
let length = input[0];
let sum = input[1];
let arrayMax = [], max = -1;
let arrayMin = [], min = -1;

for (let i = 0; i<length; i++) {
  arrayMax.push(0);
  arrayMin.push(0);
}

// МАКСИМУМ
arrayMax[length - 1] = sum;
let ost = 0;
for(let i = length -1; i>=0; i--) {
  arrayMax[i] += ost;
  ost = 0;

  if (arrayMax[i] > 9) {
    ost = arrayMax[i] - 9;
    arrayMax[i] = 9;
  }
}

if (ost === 0 && (sum !== 0 || length === 1)) {
  max = arrayMax.reverse().join('');
}

ost = 0;

// МИНИМУМ

if(length > 1) {
  arrayMin[length - 1] = sum - 1;
  arrayMin[0] = 1;
} else {
  arrayMin[length - 1] = sum;
}

for(let i = length -1; i>=0; i--) {
  arrayMin[i] += ost;
  ost = 0;

  if (arrayMin[i] > 9) {
    ost = arrayMin[i] - 9;
    arrayMin[i] = 9;
  }
}

if (ost === 0 && (sum !== 0 || length === 1)) {
  min = arrayMin.join('');
}

write(min + ' ' + max);

var inp = readline().split(" ").map(function(x){return parseInt(x);});
	var m = inp[0];
	var s = inp[1];
	var maximum='',minimum='';
	if(s === 0)
	{
		if(m === 1){
			maximum = '0';
			minimum = '0';
		}
		else
		{
			maximum = '-1';
			minimum = '-1';
		}
	}else if(s > m*9){
		maximum = '-1';
		minimum = '-1';
	}
	else if(m === 1){
		maximum = s.toString();
		minimum = s.toString();
	}
	else{
		/*最大值*/
		if(s < 9){
			maximum = s.toString();
			for(var i = 2; i <= m; i++)
			{
				maximum += '0';
			}
		}
		else if(s >= 9){
			var ans = s;
			maximum = '9';
			ans = ans-9;
			while(ans > 0){
				if(ans >= 9){
					maximum = maximum+'9';
					ans -= 9;
				}
				else {
					maximum += ans.toString();
					ans -= ans;
				}
			}
			var len='';
			for(var j = 1; j <= m-maximum.length; j++)
			{
				len = len+ '0';
			}
			maximum = maximum+len;
		}
		/*最小值*/
		s = s-1;
		if(s < 9){
			var s1 = s;
			minimum = (s1).toString();
			var len1='';
			for(var k = 1; k <= m-2; k ++)
			{
				len1 = len1+'0';
			}
			minimum = '1'+len1+minimum;
		}
		else {
			var ans1 = s;
			var flag = 0;
			var temp=0;
			minimum = '9';
			ans1 = ans1 - 9;
			while(ans1 > 0){
				if(minimum.length === m-1)
				{
					temp = ans1;
					ans1 = 0;
					flag = 1;
					break;
				}
				else{
					if(ans1 >= 9){
						minimum = '9'+minimum;
						ans1 -= 9;
						}
					else{
						minimum = ans1.toString()+minimum;
						ans1 -= ans1;
					}
				}
			}
			if(flag === 1)
			{
				minimum = (temp+1).toString()+minimum;
			}
			else{
				var temp1 = '';
				for(var l = 1; l < m-minimum.length; l ++)
				{
					temp1 = temp1+'0';
				}
				minimum = '1'+temp1+minimum;
			}
		}
	}
	print(minimum+" "+maximum);

function foo(m, s) {
  if (m === 1 && s === 0) {
    return { min: 0, max: 0 }
  }

  if (m*9 < s || s === 0) {
    return { min: '-1', max: '-1' }
  }

  var maxArr = [];

  var i=0;
  while (i != m) {
    if (s/9 >= 1) {
      maxArr[i] = 9;
      s -= 9;
    } else {
      maxArr[i] = s;
      s -= s;
    }

    i++;
  }

  var max = '';
  for (var j=0; j<maxArr.length; j++) {
    max += maxArr[j];
  }

  var minArray = maxArr.reverse();

  if (minArray[0] === 0) {
    minArray[0] = 1;

    for (var l=1; l < m; l++) {
      if (minArray[l] > 0) {
        minArray[l]--;
        break;
      }
    }
  }

  var min = '';
  for (var k=0; k<minArray.length; k++) {
    min += minArray[k];
  }

  return { min: min, max: max };
}

var args = readline().split(" ").map(function(x) { return parseInt(x); });

var res = foo(args[0], args[1]);

write(res.min + ' ' + res.max);

var line = readline().split(' ');
var m = parseInt(line[0]);
var s = parseInt(line[1]);

if (s == 0) {
	if (m == 1)
		print('0 0');
	else
		print('-1 -1');
}
else {
	var minNum = parseInt(s/9) + (s % 9 ? 1 : 0);
	if (minNum > m) {
		print('-1 -1');
	}
	else {
		//there is a solution
		var ansBig = [];
		var ss = s;
		for (var i = 0; i < m; i++) {
			if (s > 9) {
				ansBig[i] = 9;
				s -= 9;
			}
			else {
				ansBig[i] = s;
				s = 0;
			}
		}
		s = ss;
		var ansSmall = [];
		for (var i = 0; i < m; i++) {
			if (s > 9) {
				ansSmall[i] = 9;
				s -= 9;
			} else if (s > 0) {
				if (i + 1 < m) {
					ansSmall[i] = s - 1;
					s = 1;
				} else {
					ansSmall[i] = s;
					s = 0;
				}
			}
		}
		ansBig = ansBig.join('');
		ansSmall = ansSmall.reverse().join('');
		print(ansSmall + ' ' + ansBig);
	}
}

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

if (m * 9 === s) {
    var result = (new Array(m).fill(9)).join('');
    write([result, result].join(' '));
    quit();
}

var getMin = function () {
    var result = [1].concat(new Array(m - 1).fill(0));
    var cs = 1;

    for (var i = result.length - 1; i >= 0; --i) {
        while (result[i] < 9) {
            if (cs === s) {
                return result.join('');
            }

            ++result[i];
            ++cs;
        }
    }

    return '-1';
};

var getMax = function () {
    var result = [1].concat(new Array(m - 1).fill(0));
    var cs = 1;

    for (var i = 0; i <= result.length; ++i) {
        while (result[i] < 9) {
            if (cs === s) {
                return result.join('');
            }

            ++result[i];
            ++cs;
        }
    }

    return '-1';
};

write([getMin(), getMax()].join(' '));

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

var printResult = function (arrayMin, arrayMax) {
    write([arrayMin.join(''), (arrayMax || arrayMin).join('')].join(' '));
    quit();
};

if (s === 0) {
    printResult(m === 1 ? [0] : [-1]);
}

if (m * 9 === s) {
    printResult(new Array(m).fill(9));
}

var getMin = function () {
    var result = [1].concat(new Array(m - 1).fill(0));
    var cs = 1;

    for (var i = result.length - 1; i >= 0; --i) {
        while (result[i] < 9) {
            if (cs++ === s) {
                return result;
            }

            ++result[i];
        }
    }

    return [-1];
};

var getMax = function () {
    var result = new Array(m).fill(0);
    var cs = 0;

    for (var i = 0; i <= result.length; ++i) {
        while (result[i] < 9) {
            if (cs++ === s) {
                return result;
            }

            ++result[i];
        }
    }

    return [-1];
};

printResult(getMin(), getMax());

const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let [m, s] = input[0].split(' ').map(x => parseInt(x));
  if (s === 0 || m*9 < s) {
    if (m === 1 && s === 0)
      console.log(`0 0`);
    else
      console.log(`-1 -1`);
  } else {
    let bigAnswer = [];
    let smallAnswer = [1];
    let smallSumm = s - 1;

    if (s <= 9 && m === 1) {
      console.log(`${s} ${s}`); return;
    }

    if (s <= 9) {
      bigAnswer.push(s);
      bigAnswer = bigAnswer.concat(Array(m-1).fill(0));
    } else {
      while (s !== 0) {
        if (s - 9 < 0) {
          bigAnswer.push(s); break;
        }

        bigAnswer.push(9);
        s -= 9;
      }
      bigAnswer = bigAnswer.concat(Array(m - bigAnswer.length).fill(0));
    }

    let smallTmpNums = [];
    while (smallSumm !== 0) {
      if (smallSumm - 9 < 0) {
        smallTmpNums.push(smallSumm); break;
      }

      smallTmpNums.push(9);
      smallSumm -= 9;
    }

    if (smallTmpNums.length + 1 < m) {
      smallAnswer = smallAnswer.concat(Array( m - (smallTmpNums.length + 1) ).fill(0)).concat(smallTmpNums.reverse());
    } else {
      smallAnswer = smallAnswer.concat(smallTmpNums.reverse());
    }
    if (smallAnswer.length > bigAnswer.length) {
      smallAnswer = [...bigAnswer].reverse();
    }

    console.log(`${smallAnswer.join('')} ${bigAnswer.join('')}`)
  }
});

var solution = function() {

	//Считываем данные
	var input = readline().split(' ');
	var count = input[0];
	var sum = input[1];

	//Проверяем, что можно
	if (9*count < sum || sum == 0 && count > 1) {
		print(-1, -1);
		return;
	}

	//максимальное число
	var mx = "";
	var sumLeft = sum;
	var countLeft = count;
	while (countLeft) {
		mx += Math.min(9, sumLeft);
		sumLeft -= Math.min(9, sumLeft);
		countLeft--;
	}

	//минимальное число
	var mn = "";
	var countLeft = count;
	var sumLeft = sum;
	while (countLeft) {
		var cur = Math.max(sumLeft - (countLeft-1)*9, 0);

		if (!cur && countLeft == count && sumLeft > 0) {
			cur = 1;
		}

		mn += cur;
		sumLeft -= cur;

		countLeft--;
	}

	//вывод
	print(mn, mx);

}

solution();

// Lang: Node.js
'use strict';
let x = '', y = 0;
let print = x => console.log(x);

process.stdin.on('data', inputStdin => x += inputStdin);
process.stdin.on('end', () => { x = x.split('\n'); main(); });
let readline = () => x[y++];

// ************************ Code Start ***************************

function main() {

  var ar = readline().split(" ");
  var n = ar[0], m = ar[1];

  if (9 * n < m || (m == 0 && n > 1)) print(-1 + " " + -1);
  else {
    var mx = "", mm = m, nn = n;
    while (nn) {
      mx += Math.min(9, mm);
      mm -= Math.min(9, mm);
      nn--;
    }
    var mn = "", nn = n, mm = m;
    while (nn) {
      var res = Math.max(mm - (nn - 1) * 9, 0);
      if (!res && nn == n && mm > 0) res = 1;
      mn += res;
      mm -= res;
      nn--;
    }
    print(mn + " " + mx);
  }
}

var input = readline().split(' ').map(Number), m = input[0], s = input[1];
if (s > 9 * m) write('-1 -1');
else if (m > 1 && s === 0) write('-1 -1');
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - 1);
        if (m == 1) cur++;
        small = cur.toString() + small;
        smallS -= cur;
        m--;

    }
    write (small + ' ' + big);
}

function solve()
{
var st=[],ss=[];
var line = readline().split(" ");
var m = parseInt(line[0]);
var s = parseInt(line[1]);

if(m===1&&s===0)
{
    print(0,0);
    return;
}
if(m>1&&s===0)
{
    print(-1,-1);
    return;
}
for(var i=0;i<m;i++)
{
    if(s>=9)
    {
        st.push(9);
        ss.push(9);
        s-=9;

    }
    else{
        st.push(s);
        ss.push(s);
        s=0;
    }
}
if(st.length!==m||s>0)
{
print(-1,-1);
return;
}

ss.reverse();
for (var k = 0; k < ss.length; k++)
    {
        if (ss[k] !== 0)
        {
            ss[k]=ss[k]-1;
            ss[0]=ss[0]+1;
            break;
        }
    }

print(ss.join(""));
print(st.join(""));

    return;
}
solve();

if (!readline) {
    var _i = 0;

    var readline = function() {
        _i ++;

        switch (_i) {
            case 1: return '3 0';
        }
    }

    var write = console.log;
}

var x = readline().split(' ');

var m = +x[0];
var s = +x[1];

var f = [];

for (var i = 0; i <= s; i ++) {
    f[i] = [];
    for (var j = 0; j <= m; j ++) {
        f[i][j] = false;
    }
}

for (var j = 0; j <= m; j ++) {
    f[0][j] = true;

}

for (var i = 1; i <= s; i ++) {
    for (var j = 1; j <= m; j ++) {
        for (var k = 0; k <= 9; k ++) {
            f[i][j] = f[i][j] || (i-k >= 0 ? f[i-k][j-1] : false);
        }
    }
}

if (f[s][m] && !(m > 1 && s == 0)) {
    var i = s;
    var j = m;
    var nmax = '';
    var nmin = '';

    while (j > 0) {
        for (var k = 9; k >= 1; k --) {
            if (i-k >= 0 && f[i-k][j-1]) {
                nmax += k;
                i -= k;
                break;
            }
        }
        j --;
    }

    while (nmax.length < m) {
        nmax += '0';
    }

    i = s;
    j = m;

    while (j > 0) {
        for (var k = (j == m ? 1 : 0); k <= 9; k ++) {
            if (i-k >= 0 && f[i-k][j-1]) {
                nmin += k;
                i -= k;
                break;
            }
        }
        j --;
    }

    while (nmin.length < m) {
        nmin += '0';
    }

    write(nmin + ' ' + nmax);
} else {
    write('-1 -1');
}

'use strict'

const fn = (M, S) => {
    if (S === 0) return M === 1 ? '0 0' : '-1 -1'
    if (S > 9 * M) return '-1 -1'
    const s = (S - 1) % 9 + 1;
    let r = Array((S - s) / 9 + 1).join('9');
    if (M - 1 === r.length) return `${s}${r} ${r}${s}`;
    const zzz = Array(M - 1 - r.length).join('0');
    return `1${zzz}${s-1}${r} ${r}${s}${zzz}0`;
}
const x = readline().split(' ');
print(fn(parseInt(x[0]), parseInt(x[1])));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var m = inp[0];
var s = inp[1];
var sMin = s;
var sMax = s;

var numberMin = "";
var numberMax = "";
var sum = 0;
var min = -1;
var max = -1;

if (s == 0){
	if (m == 0){
		print(0);
		print(0);
	}else{
		print(-1);
		print(-1);
	}
} else {
	if (s > m * 9){
		print(-1);
		print(-1);
	} else
	{
		var k = 1;

		for(var i=m; i > 0; i--){
			function getMin(){
				if (i==m){
					return Math.min(Math.max(1, sMin - (i-1) * 9), 9);
				} else
				{
					return Math.min(Math.max(0, sMin - (i-1) * 9), 9);
				}
			}

			function getMax(){
				return Math.min(Math.max(sMax - (i-1) * 9, 9), sMax);
			}

			min = getMin();
			numberMin += min;
			sMin -= min;

			max = getMax();
			numberMax += max;
			sMax -= max;
		}

		print(numberMin);
		print(numberMax);
	}
}

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var m = inp[0];
var s = inp[1];
var sMin = s;
var sMax = s;

var numberMin = "";
var numberMax = "";
var sum = 0;
var min = -1;
var max = -1;

if (s == 0){
	if (m == 0){
		print("0 0");
	}else{
		print("-1 -1");
	}
} else {
	if (s > m * 9){
		print("-1 -1");
	} else
	{
		var k = 1;

		for(var i=m; i > 0; i--){
			function getMin(){
				if (i==m){
					return Math.min(Math.max(1, sMin - (i-1) * 9), 9);
				} else
				{
					return Math.min(Math.max(0, sMin - (i-1) * 9), 9);
				}
			}

			function getMax(){
				return Math.min(Math.max(sMax - (i-1) * 9, 9), sMax);
			}

			min = getMin();
			numberMin += min;
			sMin -= min;

			max = getMax();
			numberMax += max;
			sMax -= max;
		}

		print(numberMin + " " + numberMax);
	}
}

function calculate(m,s){
	var maximum='',minimum='';
	if(s === 0)
	{
		if(m === 1){
			maximum = '0';
			minimum = '0';
		}
		else
		{
			maximum = '-1';
			minimum = '-1';
		}
	}else if(s > m*9){
		maximum = '-1';
		minimum = '-1';
	}
	else if(m === 1){
		maximum = s.toString();
		minimum = '0';
	}
	else{
		/*最大值*/
		if(s < 9){
			maximum = s.toString();
			for(var i = 2; i <= m; i++)
			{
				maximum += '0';
			}
		}
		else if(s >= 9){
			var ans = s;
			maximum = '9';
			ans = ans-9;
			while(ans > 0){
				if(ans >= 9){
					maximum = maximum+'9';
					ans -= 9;
				}
				else {
					maximum += ans.toString();
					ans -= ans;
				}
			}
			var len='';
			for(var j = 1; j <= m-maximum.length; j++)
			{
				len = len+ '0';
			}
			maximum = maximum+len;
		}
		/*最小值*/
		s = s-1;
		if(s < 9){
			var s1 = s;
			minimum = (s1).toString();
			var len1='';
			for(var k = 1; k <= m-2; k ++)
			{
				len1 = len1+'0';
			}
			minimum = '1'+len1+minimum;
		}
		else {
			var ans1 = s;
			var flag = 0;
			var temp=0;
			minimum = '9';
			ans1 = ans1 - 9;
			while(ans1 > 0){
				if(minimum.length === m-1)
				{
					temp = ans1;
					ans1 = 0;
					flag = 1;
					break;
				}
				else{
					if(ans1 >= 9){
					minimum = '9'+minimum;
					ans1 -= 9;
					}
					else{
						minimum = ans1.toString()+minimum;
						ans1 -= ans1;
					}
				}
			}
			if(flag === 1)
			{
				minimum = (temp+1).toString()+minimum;
			}
			else{
				var temp1 = '';
				for(var l = 2; l <= m-2; l ++)
				{
					temp1 = temp1+'0';
				}
				minimum = '1'+temp1+minimum;
			}
		}
	}
	return minimum+" "+maximum;
}
function main(){
	var m = Number(readline().split(" ")[0]);
	var s = Number(readline().split(" ")[1]);
	print(calculate(m,s));
	/*
	var m = Number(str.split(" ")[0]);
	var s = Number(str.split(" ")[1]);
	return calculate(m,s);*/
}

var inp = readline().split(" ").map(function(x){return parseInt(x);});
	var m = inp[0];
	var s = inp[1];
	var maximum='',minimum='';
	if(s === 0)
	{
		if(m === 1){
			maximum = '0';
			minimum = '0';
		}
		else
		{
			maximum = '-1';
			minimum = '-1';
		}
	}else if(s > m*9){
		maximum = '-1';
		minimum = '-1';
	}
	else if(m === 1){
		maximum = s.toString();
		minimum = '0';
	}
	else{
		/*最大值*/
		if(s < 9){
			maximum = s.toString();
			for(var i = 2; i <= m; i++)
			{
				maximum += '0';
			}
		}
		else if(s >= 9){
			var ans = s;
			maximum = '9';
			ans = ans-9;
			while(ans > 0){
				if(ans >= 9){
					maximum = maximum+'9';
					ans -= 9;
				}
				else {
					maximum += ans.toString();
					ans -= ans;
				}
			}
			var len='';
			for(var j = 1; j <= m-maximum.length; j++)
			{
				len = len+ '0';
			}
			maximum = maximum+len;
		}
		/*最小值*/
		s = s-1;
		if(s < 9){
			var s1 = s;
			minimum = (s1).toString();
			var len1='';
			for(var k = 1; k <= m-2; k ++)
			{
				len1 = len1+'0';
			}
			minimum = '1'+len1+minimum;
		}
		else {
			var ans1 = s;
			var flag = 0;
			var temp=0;
			minimum = '9';
			ans1 = ans1 - 9;
			while(ans1 > 0){
				if(minimum.length === m-1)
				{
					temp = ans1;
					ans1 = 0;
					flag = 1;
					break;
				}
				else{
					if(ans1 >= 9){
					minimum = '9'+minimum;
					ans1 -= 9;
					}
					else{
						minimum = ans1.toString()+minimum;
						ans1 -= ans1;
					}
				}
			}
			if(flag === 1)
			{
				minimum = (temp+1).toString()+minimum;
			}
			else{
				var temp1 = '';
				for(var l = 2; l <= m-2; l ++)
				{
					temp1 = temp1+'0';
				}
				minimum = '1'+temp1+minimum;
			}
		}
	}
	print(minimum+" "+maximum);

function calculate(m, s){
	var maximum, minimum;
	if(m === 1)
	{
		maximum = m.toString();
		minimum = '0';
	}
	else if(s <= m*9 && s >= (m-1)*9){
		maximum = '9';
		for(var i = 1; i <= m-2; i++)
		{
			maximum += '9';
		}
		maximum += (s - (m-1)*9).toString();
		var str = maximum.split("");
		var sign = str[str.length-1];
		if(sign === '0'){
			var str1 = str.reverse();
			var temp = str1[0];
			str1[0] = str1[1];
			str1[1] = temp;
			minimum = str1.join("");
		}
		else{
			minimum = str.reverse().join("");
		}
	}
	else
	{
		maximum = '-1';
		minimum = '-1';
	}
	return minimum+maximum;

}
function main(){
	var m = Number(readline().split(" ")[0]);
	var s = Number(readline().split(" ")[1]);
	print(calculate(m,s));
}

function calculate(m, s){
	var maximum, minimum;
	if(m === 1)
	{
		maximum = m.toString();
		minimum = '0';
	}
	else if(s <= m*9 && s >= (m-1)*9){
		maximum = '9';
		for(var i = 1; i <= m-2; i++)
		{
			maximum += '9';
		}
		maximum += (s - (m-1)*9).toString();
		var str = maximum.split("");
		var sign = str[str.length-1];
		if(sign === '0'){
			var str1 = str.reverse();
			var temp = str1[0];
			str1[0] = str1[1];
			str1[1] = temp;
			minimum = str1.join("");
		}
		else{
			minimum = str.reverse().join("");
		}
	}
	else
	{
		maximum = '-1';
		minimum = '-1';
	}
	return  minimum+' '+maximum;

}
function main(){
	var m = Number(readline().split(" ")[0]);
	var s = Number(readline().split(" ")[1]);
	print(calculate(m,s));
}

var inp = readline().split(" ").map(function(x){return parseInt(x);});
	var m = inp[0];
	var s = inp[1];
	var maximum='',minimum='';
	if(s === 0)
	{
		if(m === 1){
			maximum = '0';
			minimum = '0';
		}
		else
		{
			maximum = '-1';
			minimum = '-1';
		}
	}else if(s > m*9){
		maximum = '-1';
		minimum = '-1';
	}
	else if(m === 1){
		maximum = s.toString();
		minimum = '0';
	}
	else{
		/*最大值*/
		if(s < 9){
			maximum = s.toString();
			for(var i = 2; i <= m; i++)
			{
				maximum += '0';
			}
		}
		else if(s >= 9){
			var ans = s;
			maximum = '9';
			ans = ans-9;
			while(ans > 0){
				if(ans >= 9){
					maximum = maximum+'9';
					ans -= 9;
				}
				else {
					maximum += ans.toString();
					ans -= ans;
				}
			}
			var len='';
			for(var j = 1; j <= m-maximum.length; j++)
			{
				len = len+ '0';
			}
			maximum = maximum+len;
		}
		/*最小值*/
		s = s-1;
		if(s < 9){
			var s1 = s;
			minimum = (s1).toString();
			var len1='';
			for(var k = 1; k <= m-2; k ++)
			{
				len1 = len1+'0';
			}
			minimum = '1'+len1+minimum;
		}
		else {
			var ans1 = s;
			var flag = 0;
			var temp=0;
			minimum = '9';
			ans1 = ans1 - 9;
			while(ans1 > 0){
				if(minimum.length === m-1)
				{
					temp = ans1;
					ans1 = 0;
					flag = 1;
					break;
				}
				else{
					if(ans1 >= 9){
					minimum = '9'+minimum;
					ans1 -= 9;
					}
					else{
						minimum = ans1.toString()+minimum;
						ans1 -= ans1;
					}
				}
			}
			if(flag === 1)
			{
				minimum = (temp+1).toString()+minimum;
			}
			else{
				var temp1 = '';
				for(var l = 1; l < m-1; l ++)
				{
					temp1 = temp1+'0';
				}
				minimum = '1'+temp1+minimum;
			}
		}
	}
	print(minimum+" "+maximum);

function calculate(m, s){
	var maximum='', minimum='';
	if(m === 1)
	{
		maximum = m.toString();
		minimum = '0';
	}
	else if(s <= m*9 && s >= (m-1)*9)
	{
		maximum = '9';
		for(var i = 1; i <= m-2; i++)
		{
			maximum += '9';
		}
		maximum += (s - (m-1)*9).toString();
		var str = maximum.split("");
		var sign = str[str.length-1];
		if(sign === '0'){
			var str1 = str.reverse();
			var temp = str1[0];
			str1[0] = str1[1];
			str1[1] = temp;
			minimum = str1.join("");
		}
		else{
			minimum = str.reverse().join("");
		}
	}
	else
	{
		maximum = '-1';
		minimum = '-1';
	}
	return  minimum+' '+maximum;
}
function main(str){
	var m = Number(readline().split(" ")[0]);
	var s = Number(readline().split(" ")[1]);
	print(calculate(m,s));
}

function calculate(m, s){
	var maximum, minimum;
	if(m === 1)
	{
		maximum = m.toString();
		minimum = '0';
	}
	else if(s <= m*9 && s >= (m-1)*9){
		maximum = '9';
		for(var i = 1; i <= m-2; i++)
		{
			maximum += '9';
		}
		maximum += (s - (m-1)*9).toString();
		var str = maximum.split("");
		var sign = str[str.length-1];
		if(sign === '0'){
			var str1 = str.reverse();
			var temp = str1[0];
			str1[0] = str1[1];
			str1[1] = temp;
			minimum = str1.join("");
		}
		else{
			minimum = str.reverse().join("");
		}
	}
	else
	{
		maximum = '-1';
		minimum = '-1';
	}
	return minimum+" "+maximum;

}
function main(){
	var m = Number(readline().split(" ")[0]);
	var s = Number(readline().split(" ")[1]);
	print(calculate(m,s));
}

function calculate(m, s){
	var maximum, minimum;
	if(m === 1)
	{
		maximum = m.toString();
		minimum = '0';
	}
	else if(s <= m*9 && s >= (m-1)*9){
		maximum = '9';
		for(var i = 1; i <= m-2; i++)
		{
			maximum += '9';
		}
		maximum += (s - (m-1)*9).toString();
		var str = maximum.split("");
		var sign = str[str.length-1];
		if(sign === '0'){
			var str1 = str.reverse();
			var temp = str1[0];
			str1[0] = str1[1];
			str1[1] = temp;
			minimum = str1.join("");
		}
		else{
			minimum = str.reverse().join("");
		}
	}
	else
	{
		maximum = '-1';
		minimum = '-1';
	}
	var a=[];
	a[0] = Number(minimum);
	a[1] = Number(maximum);
	return  a;

}
function main(){
	var m = Number(readline().split(" ")[0]);
	var s = Number(readline().split(" ")[1]);
	print(calculate(m,s));
}

var inp = readline().split(" ").map(function(x){return parseInt(x);});
	var m = inp[0];
	var s = inp[1];
	var maximum='',minimum='';
	if(s === 0)
	{
		if(m === 1){
			maximum = '0';
			minimum = '0';
		}
		else
		{
			maximum = '-1';
			minimum = '-1';
		}
	}else if(s > m*9){
		maximum = '-1';
		minimum = '-1';
	}
	else if(m === 1){
		maximum = s.toString();
		minimum = '0';
	}
	else{
		/*最大值*/
		if(s < 9){
			maximum = s.toString();
			for(var i = 2; i <= m; i++)
			{
				maximum += '0';
			}
		}
		else if(s >= 9){
			var ans = s;
			maximum = '9';
			ans = ans-9;
			while(ans > 0){
				if(ans >= 9){
					maximum = maximum+'9';
					ans -= 9;
				}
				else {
					maximum += ans.toString();
					ans -= ans;
				}
			}
			var len='';
			for(var j = 1; j <= m-maximum.length; j++)
			{
				len = len+ '0';
			}
			maximum = maximum+len;
		}
		/*最小值*/
		s = s-1;
		if(s < 9){
			var s1 = s;
			minimum = (s1).toString();
			var len1='';
			for(var k = 1; k <= m-2; k ++)
			{
				len1 = len1+'0';
			}
			minimum = '1'+len1+minimum;
		}
		else {
			var ans1 = s;
			var flag = 0;
			var temp=0;
			minimum = '9';
			ans1 = ans1 - 9;
			while(ans1 > 0){
				if(minimum.length === m-1)
				{
					temp = ans1;
					ans1 = 0;
					flag = 1;
					break;
				}
				else{
					if(ans1 >= 9){
						minimum = '9'+minimum;
						ans1 -= 9;
						}
					else{
						minimum = ans1.toString()+minimum;
						ans1 -= ans1;
					}
				}
			}
			if(flag === 1)
			{
				minimum = (temp+1).toString()+minimum;
			}
			else{
				var temp1 = '';
				for(var l = 1; l < m-minimum.length; l ++)
				{
					temp1 = temp1+'0';
				}
				minimum = '1'+temp1+minimum;
			}
		}
	}
	print(minimum+" "+maximum);

var solution = function() {

	//Считываем данные
	var input = readline().split(' ');
	var count = input[0];
	var sum = input[1];

	//Проверяем, что можно
	if (9*count < sum || sum === 0 && count > 1) {
		print(-1, -1);
		return;
	}

	//максимальное число
	var mx = "";
	var sumLeft = sum;
	var countLeft = count;
	while (countLeft) {
		mx += Math.min(9, sumLeft);
		sumLeft -= Math.min(9, sumLeft);
		countLeft--;
	}

	//минимальное число
	var mn = "";
	var countLeft = count;
	var sumLeft = sum;
	while (countLeft) {
		var cur = Math.max(sumLeft - (countLeft-1)*9, 0);

		if (!cur && countLeft == count) {
			cur = 1;
		}

		mn += cur;
		sumLeft -= cur;

		countLeft--;
	}

	//вывод
	print(mn, mx);

}

solution();

var solution = function() {

	//Считываем данные
	var input = readline().split(' ');
	var count = input[0];
	var sum = input[1];

	//Проверяем, что можно
	if (9*count < sum || sum == 0 && count > 1) {
		print(-1, -1);
		return;
	}

	//максимальное число
	var mx = "";
	var sumLeft = sum;
	var countLeft = count;
	while (countLeft) {
		mx += Math.min(9, sumLeft);
		sumLeft -= Math.min(9, sumLeft);
		countLeft--;
	}

	//минимальное число
	var mn = "";
	var countLeft = count;
	var sumLeft = sum;
	while (countLeft) {
		var cur = Math.max(sumLeft - (countLeft-1)*9, 0);

		if (!cur && countLeft == count && sumLeft) {
			cur = 1;
		}

		mn += cur;
		sumLeft -= cur;

		countLeft--;
	}

	//вывод
	print(mn, mx);

}

solution();

var solution = function() {

	//Считываем данные
	var input = readline().split(' ');
	var count = input[0];
	var sum = input[1];

	//Проверяем, что можно
	if (9*count < sum || sum === 0 && count > 1) {
		print(-1, -1);
		return;
	}

	//максимальное число
	var mx = "";
	var sumLeft = sum;
	var countLeft = count;
	while (countLeft) {
		mx += Math.min(9, sumLeft);
		sumLeft -= Math.min(9, sumLeft);
		countLeft--;
	}

	//минимальное число
	var mn = "";
	var countLeft = count;
	var sumLeft = sum;
	while (countLeft) {
		var cur = Math.max(sumLeft - (countLeft-1)*9, 0);

		if (!cur && countLeft == count) {
			cur = 1;
		}

		mn += cur;
		sumLeft -= cur;

		countLeft--;
	}

	//вывод
	print(mx, mn);

}

solution();

var solution = function() {

	//Считываем данные
	var input = readline().split(' ');
	var count = input[0];
	var sum = input[1];

	//Проверяем, что можно
	if (9*count < sum || sum == 0 && count > 1) {
		print(-1, -1);
		return;
	}

	//максимальное число
	var mx = "";
	var sumLeft = sum;
	var countLeft = count;
	while (countLeft) {
		mx += Math.min(9, sumLeft);
		sumLeft -= Math.min(9, sumLeft);
		countLeft--;
	}

	//минимальное число
	var mn = "";
	var countLeft = count;
	var sumLeft = sum;
	while (countLeft) {
		var cur = Math.max(sumLeft - (countLeft-1)*9, 0);

		if (!cur && countLeft == count) {
			cur = 1;
		}

		mn += cur;
		sumLeft -= cur;

		countLeft--;
	}

	//вывод
	print(mx, mn);

}

solution();

var solution = function() {

	//Считываем данные
	var input = readline().split(' ');
	var count = input[0];
	var sum = input[1];

	//Проверяем, что можно
	if (9*count < sum || sum == 0 && count > 1) {
		print(-1, -1);
		return;
	}

	//максимальное число
	var mx = "";
	var sumLeft = sum;
	var countLeft = count;
	while (countLeft) {
		mx += Math.min(9, sumLeft);
		sumLeft -= Math.min(9, sumLeft);
		countLeft--;
	}

	//минимальное число
	var mn = "";
	var countLeft = count;
	var sumLeft = sum;
	while (countLeft) {
		var cur = Math.max(sumLeft - (countLeft-1)*9, 0);

		if (!cur && countLeft == count) {
			cur = 1;
		}

		mn += cur;
		sumLeft -= cur;

		countLeft--;
	}

	//вывод
	print(mn, mx);

}

solution();

function solve()
{
var st=[],ss=[];
var line = readline().split(" ");
var m = parseInt(line[0]);
var s = parseInt(line[1]);

if(m===1&&s===2)
{
    print(0,0);
    return;
}
if(m>1&&s===0)
{
    print(-1,-1);
    return;
}
for(var i=0;i<m;i++)
{
    if(s>=9)
    {
        st.push(9);
        ss.push(9);
        s=s-9;

    }
    else{
        st.push(s);
        ss.push(s);
        s=0;
    }
}

ss.reverse();
for (var k = 0; k < ss.length; k++)
    {
        if (ss[k] !== 0)
        {
            ss[k]=ss[k]-1;
            ss[0]=ss[0]+1;
            break;
        }
    }

print(ss.join(""));
print(st.join(""));

    return;
}
solve();

function solve()
{
var st=[],ss=[];
var line = readline().split(" ");
var m = parseInt(line[0]);
var s = parseInt(line[1]);

if(m===1&&s===2)
{
    print(0,0);
    return;
}
if(m>1&&s===0)
{
    print(-1,-1);
    return;
}
for(var i=0;i<m;i++)
{
    if(s>=9)
    {
        st.push(9);
        ss.push(9);
        s=s-9;
        print(s);
    }
    else{
        st.push(s);
        ss.push(s);
        s=0;
    }
}

ss.reverse();
for (var k = 0; k < ss.length; k++)
    {
        if (ss[k] !== 0)
        {
            ss[k]--;
            ss[0]++;
            break;
        }
    }

print(ss.join(""));
print(st.join(""));

    return;
}
solve();

'use strict'

const q = [];
const r = [];
const input = readline().split(' ').map(Number);
let x = { m: input[0], s: input[1], h: '' };
for(let i = 1; i < Math.min(10, x.s + 1); i++) q.push({ m: x.m - 1, s: x.s - i, h: `${i}` });
while(q.length) {
    x = q.pop();
    if (x.m === 0 && x.s === 0) r.push(x.h);
    if (x.m === 0 || x.s === 0) continue;
	for(let i = 0; i < Math.min(10, x.s + 1); i++)
        q.push({ m: x.m - 1, s: x.s - i, h: `${x.h}${i}` });
}
if (!r.length) print('-1 -1');
print(Math.min(...r) + ' ' + Math.max(...r))

'use strict'

const fn = (S, M) => {
    if (S === 0) return M === 1 ? '0 0' : '-1 -1'
    if (S > 9 * M) return '-1 -1'
    const s = (S - 1) % 9 + 1;
    let r = Array((S - s) / 9 + 1).join('9');
    if (M - 1 === r.length) return `${s}${r} ${r}${s}`;
    const zzz = Array(M - 1 - r.length).join('0');
    return `1${zzz}${s-1}${r} ${r}${s}${zzz}0`;
}
const x = readline().split(' ');
print(fn(parseInt(x[0]), parseInt(x[1])));

'use strict'

const x = readline().split(' ').map(Number);
const m = x[0];
const S = x[1];

if (S === 0 || S > 9 * m) {
    print('-1 -1');
} else {
    const s = (S - 1) % 9 + 1;
    let r = Array((S - s) / 9 + 1).join('9');
    if (r.length === m - 1) print(`${s}${r} ${r}${s}`);
    else {
        const zzz = Array(m - r.length - 1).join('0');
        print(`1${zzz}${s-1}${r} ${r}${s}${zzz}0`);
    }
}

'use strict'

const q = [];
const r = [];
let x = { m: parseInt(readline()), s: parseInt(readline()), h: '' };
for(let i = 1; i < Math.min(10, x.s + 1); i++) q.push({ m: x.m - 1, s: x.s - i, h: `${i}` });
while(q.length) {
    x = q.pop();
    if (x.m === 0 && x.s === 0) r.push(x.h);
    if (x.m === 0 || x.s === 0) continue;
	for(let i = 0; i < Math.min(10, x.s + 1); i++)
        q.push({ m: x.m - 1, s: x.s - i, h: `${x.h}${i}` });
}
if (!r.length) print('-1 -1');
print(Math.min(...r) + ' ' + Math.max(...r))

'use strict'

const q = [];
const r = [];
const input = readline().split(' ').map(Number);
let x = { m: input[0], s: input[1], h: '' };
for(let i = 1; i < Math.min(10, x.s + 1); i++) q.push({ m: x.m - 1, s: x.s - i, h: `${i}` });
while(q.length) {
    x = q.pop();
    if (x.m === 0 && x.s === 0) r.push(x.h);
    if (x.m === 0 || x.s === 0) continue;
	for(let i = 0; i < Math.min(10, x.s + 1); i++)
        q.push({ m: x.m - 1, s: x.s - i, h: `${x.h}${i}` });
}
if (!r.length) print('-1 -1');
else print(Math.min(...r) + ' ' + Math.max(...r))

'use strict'

const fn = (m, s) => {
    const q = [ { m, s, h: '' } ];
    const r = []
    while(q.length) {
        const x = q.pop();
        if (x.m === 0 && x.s === 0) r.push(x.h);
        if (x.m === 0 || x.s === 0) continue;
		for(let i = 1; i < Math.min(10, x.s + 1); i++)
            q.push({ m: x.m - 1, s: x.s - i, h: `${x.h}${i}` });
    }
    if (!r.length) print('-1 -1');
    print(Math.min(...r) + ' ' + Math.max(...r))
}

var n = readline(), m = readline(), h = m
            var min = "", max = ""
            var ok = true,ok2=true
            if (n > 1 && m === 0) {
                print.log("-1 -1")
            } else if (m > n * 9) {
                print.log("-1 -1")
            } else {
                for (var i = 0; i < n; ++i) {
                    if (h - 9 > 0) {
                        min += "9"
                        max += "9"
                        h -= 9
                    } else {
                        if (ok) {
                            max += h
                            ok = false
                        }
                        else
                            max += "0"
                        if (ok2){
                            if (i===n-1)min=h+min
                            else min=(h-1)+min
                            ok2=false
                        }else{
                             if(i===n-1)min="1"+min
                             else min="0"+min
                        }
                    }
                }
            }
            print(min + " " + max)

var inp = readline().split(' ');
var m = parseInt(inp[0]);
var s = parseInt(inp[1]);

var largestArr = [], smallestArr = [];
for (var i = 0; i < m; i ++) {
	largestArr.push(0);
	smallestArr.push(1);
}

var largestOn = 0, smallestOn = m - 1;
for (var i = 0; i < s; i ++) {
	if (largestOn < m) {
		largestArr[largestOn] ++;
		if (largestArr[largestOn] === 9) largestOn ++;
	} else largestArr = [-1];

	if (smallestOn >= 0 && m <= s) {
		if (i >= m) {
			smallestArr[smallestOn] ++;
			if (smallestArr[smallestOn] === 9) smallestOn --;
		}
	} else smallestArr = largestArr[0] !== -1 ? largestArr : [-1];
}

print(s === 0 ? '-1 -1' : smallestArr.join('') + ' ' + largestArr.join(''));

var inp = readline().split(' ');
var m = parseInt(inp[0]);
var s = parseInt(inp[1]);

var largestArr = [], smallestArr = [1];
for (var i = 0; i < m; i ++) {
	largestArr.push(0);
	if (i !== 0) smallestArr.push(0);
}

var largestOn = 0, smallestOn = m - 1;
for (var i = 0; i < s; i ++) {
	if (largestOn < m) {
		largestArr[largestOn] ++;
		if (largestArr[largestOn] === 9) largestOn ++;
	} else largestArr = [-1];

	if (smallestOn >= 0) {
		if (i >= 1) {
			smallestArr[smallestOn] ++;
			if (smallestArr[smallestOn] === 9) smallestOn --;
		}
	} else smallestArr = largestArr[0] !== -1 ? largestArr : [-1];
}

print(s === 0 ? '-1 -1' : smallestArr.join('') + ' ' + largestArr.join(''));

var inp = readline().split(' ');
var m = parseInt(inp[0]);
var s = parseInt(inp[1]);

var largestArr = [], smallestArr = [];
for (var i = 0; i < m; i ++) {
	largestArr.push(0);
	smallestArr.push(1);
}

var largestOn = 0, smallestOn = m - 1;
for (var i = 0; i < s; i ++) {
	if (largestOn < m) {
		largestArr[largestOn] ++;
		if (largestArr[largestOn] === 9) largestOn ++;
	} else largestArr = [-1];

	if (smallestOn >= 0 && m <= s) {
		if (i >= m) {
			smallestArr[smallestOn] ++;
			if (smallestArr[smallestOn] === 9) smallestOn --;
		}
	} else smallestArr = [-1];
}

print(s === 0 ? '-1 -1' : smallestArr.join('') + ' ' + largestArr.join(''));

var inp = readline().split(' ');
var m = parseInt(inp[0]);
var s = parseInt(inp[1]);

var largestArr = [], smallestArr = [];
for (var i = 0; i < m; i ++) {
	largestArr.push(0);
	smallestArr.push(1);
}

var largestOn = 0, smallestOn = m - 1;
for (var i = 0; i < s; i ++) {
	if (largestOn < m) {
		largestArr[largestOn] ++;
		if (largestArr[largestOn] === 9) largestOn ++;
	} else largestArr = [-1];

	if (smallestOn >= 0 && m <= s) {
		if (i >= m) {
			smallestArr[smallestOn] ++;
			if (smallestArr[smallestOn] === 9) smallestOn --;
		}
	} else smallestArr = [-1];
}

print(s === 0 ? '-1 -1' : largestArr.join('') + ' ' + smallestArr.join(''));

var enter = readline().split(' ');
var n = enter[0];
var s = enter[1];
if(s <= n * 9 && s != 0 || s == 0 && n == 1) {
	var get_max = function(n,s) {
  var max = '';
  	while(n--) {
  		if( s >= 9) {
    max += 9;
    s -= 9;
    } else {
    max += s;
		s = 0;
    }
  }
  return max;
  };
  	var get_min = function(n,s) {
  	var first = true;
  	var min = '';
  		while(n--) {
  		var mn = first && n ? 1 : 0;
		var cur = Math.max(mn, s-9*n);
		s -= cur;
		min += cur;
		first = false;
  }
  return min;
  };
  print(get_min(n, s), get_max(n, s));
} else {
	print(1, -1);
}

var enter = readline().split(' ');
var n = enter[0];
var s = enter[1];
if(s <= n * 9 && s != 0 || s == 0 && n == 1) {
	var get_max = function(n,s) {
  var max = '';
  	while(n--) {
  		if( s >= 9) {
    max += 9;
    s -= 9;
    } else {
    max += s;
		s = 0;
    }
  }
  return max;
  };
  	var get_min = function(n,s) {
  	var first = true;
  	var min = '';
  		while(n--) {
  		var mn = first && n ? 1 : 0;
		var cur = Math.min(mn, s-9*n);
		s -= cur;
		min += cur;
		first = false;
  }
  return min;
  };
  print(get_min(n, s), get_max(n, s));
} else {
	print(1, -1);
}

'use strict';

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let input = readline().getNumArray();
let length = input[0];
let sum = input[1];
let arrayMax = [], max = -1;
let arrayMin = [], min = -1;

for (let i = 0; i<length; i++) {
  arrayMax.push(0);
  arrayMin.push(0);
}

// МАКСИМУМ
arrayMax[length - 1] = sum;
let ost = 0;
for(let i = length -1; i>=0; i--) {
  arrayMax[i] += ost;
  ost = 0;

  if (arrayMax[i] > 9) {
    ost = arrayMax[i] - 9;
    arrayMax[i] = 9;
  }
}

if (ost === 0 && sum !== 0) {
  max = parseInt(arrayMax.reverse().join(''));
}

ost = 0;

// МИНИМУМ
arrayMin[length - 1] = sum - 1;
arrayMin[0] = 1;

for(let i = length -1; i>=0; i--) {
  arrayMin[i] += ost;
  ost = 0;

  if (arrayMin[i] > 9) {
    ost = arrayMin[i] - 9;
    arrayMin[i] = 9;
  }
}

if (ost === 0 && sum !== 0) {
  min = parseInt(arrayMin.join(''));
}

write(min + ' ' + max);

'use strict';

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let input = readline().getNumArray();
let length = input[0];
let sum = input[1];
let arrayMax = [], max = -1;
let arrayMin = [], min = -1;

for (let i = 0; i<length; i++) {
  arrayMax.push(0);
  arrayMin.push(0);
}

// МАКСИМУМ
arrayMax[length - 1] = sum;
let ost = 0;
for(let i = length -1; i>=0; i--) {
  arrayMax[i] += ost;
  ost = 0;

  if (arrayMax[i] > 9) {
    ost = arrayMax[i] - 9;
    arrayMax[i] = 9;
  }
}

if (ost === 0 && sum !== 0) {
  max = arrayMax.reverse().join('');
}

ost = 0;

// МИНИМУМ

if(length > 1) {
  arrayMin[length - 1] = sum - 1;
  arrayMin[0] = 1;
} else {
  arrayMin[length - 1] = sum;
}

for(let i = length -1; i>=0; i--) {
  arrayMin[i] += ost;
  ost = 0;

  if (arrayMin[i] > 9) {
    ost = arrayMin[i] - 9;
    arrayMin[i] = 9;
  }
}

if (ost === 0 && sum !== 0) {
  min = arrayMin.join('');
}

write(min + ' ' + max);

'use strict';

String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let input = readline().getNumArray();
let length = input[0];
let sum = input[1];
let arrayMax = [], max = -1;
let arrayMin = [], min = -1;

for (let i = 0; i<length; i++) {
  arrayMax.push(0);
  arrayMin.push(0);
}

// МАКСИМУМ
arrayMax[length - 1] = sum;
let ost = 0;
for(let i = length -1; i>=0; i--) {
  arrayMax[i] += ost;
  ost = 0;

  if (arrayMax[i] > 9) {
    ost = arrayMax[i] - 9;
    arrayMax[i] = 9;
  }
}

if (ost === 0 && sum !== 0) {
  max = arrayMax.reverse().join('');
}

ost = 0;

// МИНИМУМ
arrayMin[length - 1] = sum - 1;
arrayMin[0] = 1;

for(let i = length -1; i>=0; i--) {
  arrayMin[i] += ost;
  ost = 0;

  if (arrayMin[i] > 9) {
    ost = arrayMin[i] - 9;
    arrayMin[i] = 9;
  }
}

if (ost === 0 && sum !== 0) {
  min = arrayMin.join('');
}

write(min + ' ' + max);

function foo(m, ss) {
  if (m*9 < ss || ss === 0) {
    return { min: '-1', max: '-1' }
  }

  var maxArr = [];

  var s = ss;
  var i=0;
  while (i != m) {
    if (s/9 >= 1) {
      maxArr[i] = 9;
      s -= 9;
    } else {
      maxArr[i] = s;
      s -= s;
    }

    i++;
  }

  var max = '';
  for (var j=0; j<maxArr.length; j++) {
    max += maxArr[j];
  }

  var minArray = maxArr.reverse();

  if (ss === maxArr[0]) {
    minArray[m-1]--;
    minArray[0] = 1;
  }

  var min = '';
  for (var k=0; k<minArray.length; k++) {
    min += minArray[k];
  }

  return { min: min, max: max };
}

var args = readline().split(" ").map(function(x) { return parseInt(x); });

var res = foo(args[0], args[1]);

write(res.min + ' ' + res.max);

const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let [m, s] = input[0].split(' ').map(x => parseInt(x));
  if (s === 0 || m*9 < s) {
    if (m === 1 && s === 0)
      console.log(`0 0`);
    else
      console.log(`-1 -1`);
  } else {
    let bigAnswer = [];
    let smallAnswer = [1];
    let smallSumm = s - 1;

    if (s <= 9 && m === 1) {
      console.log(`${s} ${s}`); return;
    }

    if (s <= 9) {
      bigAnswer.push(s);
      bigAnswer = bigAnswer.concat(Array(m-1).fill(0));
    } else {
      while (s !== 0) {
        if (s - 9 < 0) {
          bigAnswer.push(s); break;
        }

        bigAnswer.push(9);
        s -= 9;
      }
      bigAnswer = bigAnswer.concat(Array(m - bigAnswer.length).fill(0));
    }

    let smallTmpNums = [];
    while (smallSumm !== 0) {
      if (smallSumm - 9 < 0) {
        smallTmpNums.push(smallSumm); break;
      }

      smallTmpNums.push(9);
      smallSumm -= 9;
    }

    if (smallTmpNums.length + 1 < m) {
      smallAnswer = smallAnswer.concat(Array( m - (smallTmpNums.length + 1) ).fill(0)).concat(smallTmpNums.reverse());
    } else {
      smallAnswer = smallAnswer.concat(smallTmpNums.reverse());
    }

    console.log(`${smallAnswer.join('')} ${bigAnswer.join('')}`)
  }
});

const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let [m, s] = input[0].split(' ').map(x => parseInt(x));
  if (s === 0 || m*9 < s) {
    console.log(`-1 -1`);
  } else {
    let answer = [];
    if (s <= 9) {
      answer.push(s);
      answer = answer.concat(Array(m-1).fill(0));

      console.log(`${answer.join('')} ${answer.join('')}`);
      return;
    }

    let len = 0;
    while (s !== 0) {
      len += 1;
      if (s - 9 < 0) {
        answer.push(s); break;
      }

      answer.push(9);
      s -= 9;
    }

    answer = answer.concat(Array(m - len).fill(0));
    let reverse = [...answer].reverse();

    if (reverse[0] === 0)
      for (let i = 0; i < reverse.length; i += 1) {
        if (reverse[i] !== 0) {
          reverse[0] = reverse[i];
          reverse[i] = 0; break;
        }
      }

    console.log(`${reverse.join('')} ${answer.join('')}`);
  }
});

const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let [m, s] = input[0].split(' ').map(x => parseInt(x));
  if (s === 0 || m*9 < s) {
    console.log(`-1 -1`);
  } else {
    let answer = [];
    if (s <= 9) {
      answer.push(s);
      answer = answer.concat(Array(m-1).fill(0));

      console.log(`${answer.join('')} ${answer.join('')}`);
      return;
    }

    let len = 0;
    while (s !== 0) {
      len += 1;
      if (s - 9 < 0) {
        answer.push(s); break;
      }

      answer.push(9);
      s -= 9;
    }

    answer = answer.concat(Array(m - len).fill(0));
    console.log(`${[...answer].reverse().join('')} ${answer.join('')}`);
  }
});

const readLine = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
  let [m, s] = input[0].split(' ').map(x => parseInt(x));
  if (s === 0 || m*9 < s) {
    if (m === 1 && s === 0)
      console.log(`0 0`);
    else
      console.log(`-1 -1`);
  } else {
    let answer = [];
    if (s <= 9) {
      answer.push(s);
      answer = answer.concat(Array(m-1).fill(0));

      console.log(`${answer.join('')} ${answer.join('')}`);
      return;
    }

    let len = 0;
    while (s !== 0) {
      len += 1;
      if (s - 9 < 0) {
        answer.push(s); break;
      }

      answer.push(9);
      s -= 9;
    }

    answer = answer.concat(Array(m - len).fill(0));
    let reverse = [...answer].reverse();

    if (reverse[0] === 0)
      for (let i = 0; i < reverse.length; i += 1) {
        if (reverse[i] !== 0) {
          reverse[0] = reverse[i];
          reverse[i] = 0; break;
        }
      }

    console.log(`${reverse.join('')} ${answer.join('')}`);
  }
});

function foo(m, s) {
  if (m*9 < s || s === 0) {
    return { min: '-1', max: '-1' };
  }

  var maxArr = [];

  var i=0;
  while (i != m) {
    if (s/9 >= 1) {
      maxArr[i] = 9;
      s -= 9;
    } else {
      maxArr[i] = s;
      s -= s;
    }

    i++;
  }

  var max = '';
  for (var j=0; j<maxArr.length; j++) {
    max += maxArr[j];
  }

  var minArray = maxArr.reverse();

  if (s === maxArr[0]) {
    minArray[m-1]--;
    minArray[0] = 1;
  }

  var min = '';
  for (var k=0; k<minArray.length; k++) {
    min += minArray[k];
  }

  return { min: min, max: max };
}

var args = readline().split(" ").map(function(x) { return parseInt(x); });

var res = foo(args[0], args[1]);

write(res.min + ' ' + res.max);

function foo(m, s) {
  if (m*9 < s || s === 0) {
    return { min: '-1', max: '-1' }
  }

  var maxArr = [];

  var i=0;
  while (i != m) {
    if (s/9 >= 1) {
      maxArr[i] = 9;
      s -= 9;
    } else {
      maxArr[i] = s;
      s -= s;
    }

    i++;
  }

  var max = '';
  for (var j=0; j<maxArr.length; j++) {
    max += maxArr[j];
  }

  var minArray = maxArr.reverse();

  if (minArray[0] === 0) {
    minArray[0] = 1;

    for (var l=1; l < m; l++) {
      if (minArray[l] > 0) {
        minArray[l]--;
        break
      }
    }
  }

  var min = '';
  for (var k=0; k<minArray.length; k++) {
    min += minArray[k];
  }

  return { min: min, max: max };
}

var args = readline().split(" ").map(function(x) { return parseInt(x); });

var res = foo(args[0], args[1]);

write(res.min + ' ' + res.max);

var line = readline().split(' ');
var m = parseInt(line[0]);
var s = parseInt(line[1]);

if (s == 0) {
	if (m == 1)
		print('0 0');
	else
		print('-1 -1');
}
else {
	var minNum = parseInt(16/9) + (16 % 9 ? 1 : 0);
	if (minNum > m) {
		print('-1 -1');
	}
	else {
		//there is a solution
		var ansBig = [];
		var ss = s;
		for (var i = 0; i < m; i++) {
			if (s > 9) {
				ansBig[i] = 9;
				s -= 9;
			}
			else {
				ansBig[i] = s;
				s = 0;
			}
		}
		s = ss;
		var ansSmall = [];
		for (var i = 0; i < m; i++) {
			if (s > 9) {
				ansSmall[i] = 9;
				s -= 9;
			} else if (s > 0) {
				if (i + 1 < m) {
					ansSmall[i] = s - 1;
					s = 1;
				} else {
					ansSmall[i] = s;
					s = 0;
				}
			}
		}
		ansBig = ansBig.join('');
		ansSmall = ansSmall.reverse().join('');
		print(ansSmall + ' ' + ansBig);
	}
}

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

var printResults = function (arrayMin, arrayMax) {
    write([arrayMin.join(''), (arrayMax || arrayMin).join('')].join(' '));
    quit();
};

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

if (m * 9 === s) {
    printResults(new Array(m).fill(9));
}

var result = [1].concat(new Array(m - 1).fill(0));

if (s === 1) {
    printResults(result);
}

var cs = 1;

for (var i = result.length - 1; i >= 0; --i) {
    while (true) {
        if (cs === s) {
            printResults(
                result.join('').split(''),
                result.splice(0, i).reverse().concat(result).reverse()
            );
        }

        if (result[i] === 9) {
            break;
        }

        ++result[i];
        ++cs;
    }
}

write('-1 -1');

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

var printResults = function (arrayMin, arrayMax) {
    write([arrayMin.join(''), (arrayMax || arrayMin).join('')].join(' '));
    quit();
};

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

if (m * 9 === s) {
    printResults(new Array(m).fill(9));
}

var result = [1].concat(new Array(m - 1).fill(0));

if (s === 1) {
    printResults(result);
}

var cs = 1;

for (var i = result.length - 1; i >= 0; --i) {
    while (true) {
        if (cs++ === s) {
            printResults(
                result.join('').split(''),
                result.splice(0, i).reverse().concat(result).reverse()
            );
        }

        if (result[i]++ === 9) {
            break;
        }
    }
}

write('-1 -1');

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

var result = [1].concat(new Array(m - 1).fill(0));

if (s === 1) {
    result = result.join('');
    write([result, result].join(' '));
    quit();
}

var cs = 1;

for (var i = result.length - 1; i >= 0; --i) {
    do {
        if (cs++ === s) {
            write([result.join(''), result.splice(0, i).reverse().concat(result).reverse().join('')].join(' '));
            quit();
        }
    } while (++result[i] < 9)
}

write('-1 -1');

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

var result = [1].concat(new Array(m - 1).fill(0));

if (s === 1) {
    result = result.join('');
    write([result, result].join(' '));
    quit();
}

var cs = 1;

for (var i = result.length - 1; i >= 0; --i) {
    while (result[i] < 9) {
        ++result[i];

        if (++cs === s) {
            write([result.join(''), result.splice(0, i).reverse().concat(result).reverse().join('')].join(' '));
            quit();
        }
    }
}

write('-1 -1');

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

var printResults = function (arrayMin, arrayMax) {
    write([arrayMin.join(''), (arrayMax || arrayMin).join('')].join(' '));
    quit();
};

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

if (m * 9 === s) {
    printResults(new Array(m).fill(9));
}

var result = [1].concat(new Array(m - 1).fill(0));

if (s === 1) {
    printResults(result);
}

var cs = 1;

for (var i = result.length - 1; i >= 0; --i) {
    while (result[i] < 9) {
        if (cs === s) {
            printResults(
                result.join('').split(''),
                result.splice(0, i).reverse().concat(result).reverse()
            );
        }

        ++result[i];
        ++cs;
    }
}

write('-1 -1');

var input = readline().split(' ').map(value => +value);
var m = input[0];
var s = input[1];

if (s === 0) {
    write(m === 1 ? '0 0' : '-1 -1');
    quit();
}

var result = [1].concat(new Array(m - 1).fill(0));
var cs = 1;

for (var i = result.length - 1; i >= 0; --i) {
    while (result[i] < 9) {
        ++result[i];

        if (++cs === s) {
            write([result.join(''),result.splice(0, i).reverse().concat(result).reverse().join('')].join(' '));
            quit();
        }
    }
}

write('-1 -1');

var input = readline().split(' ').map(Number), m = input[0], s = input[1];

if ((s < m - 1)|| (s > 9 * m)) write('-1 -1')
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - 1);
        if (m == 1) cur++;
        small = cur.toString() + small;
        smallS -= cur;
        m--;

    }
    write (small + ' ' + big);
}

var input = readline().split(' ').map(Number), m = input[0], s = input[1];

if ((s < 1)|| (s > 9 * m)) write('-1 -1')
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - 1);
        if (m == 1) cur++;
        small = cur.toString() + small;
        smallS -= cur;
        m--;

    }
    write (small + ' ' + big);
}

var input = readline().split(' ').map(Number), m = input[0], s = input[1];

if ((s < m - 1)|| (s > 9 * m)) write('-1 -1')
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - (m - 1));
        small = cur.toString() + small;
        smallS -= cur;
        m--;

    }
}
write (small + ' ' + big);

var input = readline().split(' ').map(Number), m = input[0], s = input[1];

if ((s < m - 1)|| (s > 9 * m)) write('-1 -1')
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - (m - 1));
        small = cur.toString() + small;
        smallS -= cur;
        m--;

    }
}
write (big + ' ' + small);

var input = readline().split(' ').map(Number), m = input[0], s = input[1];

if ((s < m - 1)|| (s > 9 * m)) write('-1 -1')
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - (m - 1));
        small = cur.toString() + small;
        smallS -= cur;
        m--;

        write (big + ' ' + small + '\n');

    }
}

var input = readline().split(' ').map(Number), m = input[0], s = input[1];

if ((s < m - 1)|| (s > 9 * m)) write('-1 -1')
else {
    var bigS = s;
    var smallS = s;
    var big = '';
    var small = '';
    while (m > 0) {

        if (bigS >= 9) { big = big + '9'; bigS -= 9; }
        else { big = big + bigS.toString(); bigS = 0; }

        var cur = Math.min('9', smallS - (m - 1));
        small = cur.toString() + small;
        smallS -= cur;
        m--;

    }
    write (small + ' ' + big);
}


var primes = [];

function decompose(n) {
  var res = [];
  var p = 2;
  while (true) {
    if (n >= p * p) {
      if (n % p === 0) {
        res.push(p);
        n /= p;
      } else {
        p++;
      }
    } else {
      res.push(n);
      break;
    }
  }
  return res;
}

function resolve(n) {
  var d1 = decompose(n);
  var px1 = (n / d1[d1.length - 1] - 1) * d1[d1.length - 1] + 1;
  var min = Infinity;
  var d2;
  var px2;
  for (var i = px1; i < n; i++) {
    d2 = decompose(i);
    px2 = (i / d2[d2.length - 1] - 1) * d2[d2.length - 1] + 1;
    if (px2 < min && px2 >= 3) {
      min = px2;
    }
  }
  if (min === Infinity) {
    return px1;
  }
  return min;
}

const k = parseInt(readline(), 10);

const result = resolve(k);

print(result + '\n');


//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
	var alist = nextIntArray();
	var blist = nextIntArray();
	var asum = 0;
	var bsum = 0;
	for(var i = 0; i < N; i++){
		asum += alist[i];
		bsum += blist[i];
	}
	if(asum >= bsum){
		myout("Yes");
	}else{
		myout("No");
	}
}

n = readline();
var sum1 = parseInt(readline().split(' ').reduce((a, b) => parseInt(a) + parseInt(b)));
var sum2 = parseInt(readline().split(' ').reduce((a, b) => parseInt(a) + parseInt(b)));
if(sum2 > sum1){print("NO")}
else{print("YES")}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    return total + x;
});
var sumY = y.reduce((total, x)=>{
    return total+ x;
}, 0);
if(sumX >= sumY && n>=1 && n <= 50 && n == x.length && n == y.length){
    print('Yes');
}else{
    print('No');
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let arr1, arr2;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  if (c === 1) {
    c++;
    arr1 = d.split(' ').map(Number);
    return;
  }

  arr2 = d.split(' ').map(Number);
  let ans = 0;

  for (let i = 0; i < arr1.length; i++) {
    ans += arr1[i];
  }

  for (let i = 0; i < arr2.length; i++) {
    ans -= arr2[i];
  }

  if (ans >= 0) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }

  c++;
});

var n = readline();
var firstNote = readline().split(' ');
var secondNote = readline().split(' ');
var first = 0;
var second = 0;
for(var i = 0; i < n; i++){
    first += parseInt(firstNote[i]);
    second += parseInt(secondNote[i]);
}
if(second > first){
    print('NO');
}else{
    print('YES');
}

var n= readline();
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    if(x >=0 && x<=1000)
    return total;
});
var sumY = y.reduce((total, x)=>{
    if(x >= 0 && x <= 1000)
    return total;
});
if(sumX <= sumY && n>=1 && n <= 50){
    print('Yes');
}else{
    print('No');
}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    if(x >=0 && x<=1000)
    return total;
});
var sumY = y.reduce((total, x)=>{
    if(x >= 0 && x <= 1000)
    return total;
});
if(sumX <= sumY && n>=1 && n <= 50 && n == x.length && n == y.length){
    print('Yes');
}else{
    print('No');
}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    if(x >=0 && x<=1000)
    return total;
});
var sumY = y.reduce((total, x)=>{
    if(x >=0 && x<=1000)
    return total;
});
if(sumX <= sumY && n>=1 && n <= 50){
    print('Yes');
}else{
    print('No');
}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    return total;
});
var sumY = y.reduce((total, x)=>{
    return total;
});
if(sumX <= sumY){
    print('Yes');
}else{
    print('No');
}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    if(x >=0 && x<=1000)
    return total;
});
var sumY = y.reduce((total, x)=>{
    if(x >= 0 && x <= 1000)
    return total;
});
if(sumX <= sumY && n>=1 && n <= 50){
    print('Yes');
}else{
    print('No');
}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    return total;
});
var sumY = y.reduce((total, x)=>{
    return total;
});
if(sumX <= sumY && n>=1 && n <= 50){
    print('Yes');
}else{
    print('No');
}

var n= readline('n');
var x = readline().split(" ").map(function(x) { return parseInt(x); });;
var y = readline().split(" ").map(function(x) { return parseInt(x); });;
var sumX = x.reduce((total, x)=>{
    if(x >=0 && x<=1000)
    return total;
});
var sumY = y.reduce((total, x)=>{
    if(x >= 0 && x <= 1000)
    return total;
});
if(sumX >= sumY && n>=1 && n <= 50){
    print('Yes');
}else{
    print('No');
}

 var n = readline();
var sum1 = readline().split(' ').reduce((a, b) => a + b);
var sum2 = readline().split(' ').reduce((a, b) => a + b);
if(sum1 >= sum2){print("YES")}
else{print("NO")}

n = readline();
var sum1 = readline().split(' ').reduce((a, b) => parseInt(a) + parseInt(b));
var sum2 = readline().split(' ').reduce((a, b) => parseInt(a) + parseInt(b));
if(sum2 > sum1){print("NO")}
else{print("YES")}

n = readline();
var sum1 = readline().split(' ').reduce((a, b) => a + b);
var sum2 = readline().split(' ').reduce((a, b) => a + b);
if(sum2 > sum1){print("NO")}
else{print("YES")}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let arr1, arr2;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  if (c === 1) {
    c++;
    arr1 = d.split(' ').map(Number);
    return;
  }

  arr2 = d.split(' ').map(Number);
  const sum = arr1.reduce((a, b) => a + b, 0) + arr2.reduce((a, b) => a + b, 0);

  if (sum % 2 === 0) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }

  c++;
});


function main() {
    var data = readline().split(' ').map(Number);
    var n = data[0];
    var k= data[1];

    var endDivisors = [];
    var startDivisors = [];
    var num = n;
    var square_root = Math.floor(Math.sqrt(num)) + 1;
    for (var i = 1; i < square_root; i++) {
        if (num % i == 0&&i*i!=num){
            startDivisors.push(i);
            endDivisors.push(num/i)
        }
        if (num % i == 0&&i*i==num){
            startDivisors.push(i)
        }
    }
    var res = -1;
    if(startDivisors[k-1]){
        res = startDivisors[k-1];
    } else if (endDivisors[endDivisors.length - (k-startDivisors.length) ]){
        res = endDivisors[endDivisors.length - (k-startDivisors.length) ]
    }
    print(res);
}

main()

function main(){
	var numbers = readline().split(" ").map(Number);

	var num = numbers[0];
	var kthdiv = numbers[1];
	var divs = [];

	if(numbers[1] === 1)
		return 1;

	if(numbers[0] === 1 && numbers[1] !== 1)
        return -1;

	divs.push(1);

	var numDiv = 1;

	for(var i = 2; i <= Math.sqrt(num); i++)
		if(num % i === 0 && ++numDiv === kthdiv)
			return i;
		else if(num % i === 0)
			divs.push(i);

	for(i = divs.length-1; i >= 0; i--)
        if(num / divs[i] !== divs[i])
            divs.push(num/divs[i]);

	if(kthdiv <= divs.length)
		return divs[kthdiv-1];

	return -1;
}

print(main());

function main(){
	var numbers = readline().split(" ").map(Number);

	var num = numbers[0];
	var kthdiv = numbers[1];
	var divs = [];

	if(numbers[1] === 1)
		return 1;

	divs.push(1);

	var numDiv = 1;

	for(var i = 2; i <= Math.sqrt(num); i++)
		if(num % i === 0 && ++numDiv === kthdiv)
			return i;
		else if(num % i === 0)
			divs.push(i);

	if(kthdiv <= divs.length*2)
		return num/divs[divs.length*2-kthdiv];

	return -1;
}

print(main());


function main(n){

    if(n % 2 !== 0){
      print(0);
      return;
    }
    else if(n % 4 !== 0){
      print(Math.floor(n/4));
    }
    else{
      print((n/4) - 1);
    }
}

var n = parseInt(readline());

// var arr = readline().split(' ');
// for(var i = 0  ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(n);

var n = +readline();

if(n%2 == 1){
    write(0);
}else{
    n = n/2;
    if(n%2 == 1){
        write(Math.floor(n/2));
    }else{
        write(n/2 - 1);
    }
}

var n=~~readline();
var count=0;
if(n%2!=0) print("0");
else{
    var a=n/2;
    print (Math.ceil(a/2)-1);
}

w = ~~readline()
 c= 0
if(w%2==0) {
w /= 2
c =Math.ceil(w/2) -1

}
print(c)

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let stickLength;
let lines=0;
rl.on('line', (input,index) => {
    let res=input.split(" ");

        stickLength=Number(res[0]);

    lines++;
}).on('close', () => {
    getRectangleStick(stickLength);
});

function getRectangleStick(stickLength) {
    if(stickLength<=2000000000 && stickLength%2 === 0){
        if(stickLength%4===0){
            console.log(Math.trunc((stickLength-1)/4));
        }else{
            console.log(Math.trunc(stickLength/4));
        }
    }else{
        console.log(0);
    }
}

var n = +readline();
if(n%2 == 1) write(0);

n = n/2;
if(n%2 == 1){
    write(Math.floor(n/2));
}else{
    write(n/2 - 1);
}

function main(n){

    if(n % 2 !== 0){
      print(-1);
      return;
    }
    else if(n % 4 !== 0){
      print(Math.floor(n/2));
    }
    else{
      print((n/2) - 1);
    }
}

var n = parseInt(readline());

// var arr = readline().split(' ');
// for(var i = 0  ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(n);

function main(n){

    if(n % 2 !== 0){
      print(-1);
      return;
    }
    else if(n % 4 !== 0){
      print(Math.floor(n/4));
    }
    else{
      print((n/4) - 1);
    }
}

var n = parseInt(readline());

// var arr = readline().split(' ');
// for(var i = 0  ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(n);

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let stickLength;
let lines=0;
rl.on('line', (input,index) => {
    let res=input.split(" ");

        stickLength=Number(res[0]);

    lines++;
}).on('close', () => {
    getRectangleStick(stickLength);
});

function getRectangleStick(stickLength) {
    if(stickLength<=2000000000){
        if(stickLength%4===0){
            console.log(Math.trunc((stickLength-1)/4));
        }else{
            console.log(Math.trunc(stickLength/4));
        }
    }else{
        console.log(0);
    }
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let stickLength;
let lines=0;
rl.on('line', (input,index) => {
    let res=input.split(" ");

        stickLength=Number(res[0]);

    lines++;
}).on('close', () => {
    getRectangleStick(stickLength);
});

function getRectangleStick(stickLength) {
    if(stickLength%4===0){
        console.log(Math.trunc((stickLength-1)/4));
    }else{
        console.log(Math.trunc(stickLength/4));
    }
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let stickLength;
let lines=0;
rl.on('line', (input,index) => {
    let res=input.split(" ");

        stickLength=Number(res[0]);

    lines++;
}).on('close', () => {
    getRectangleStick(stickLength);
});

function getRectangleStick(stickLength) {
    if(stickLength<1000000){
        if(stickLength%4===0){
            console.log(Math.trunc((stickLength-1)/4));
        }else{
            console.log(Math.trunc(stickLength/4));
        }
    }else{
        console.log(0);
    }
}


let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    const input = lines[1];
    const vector = input.split(' ').map(
        n => parseInt(n)
    );

    const insertionSort = (vector) => {
        let res = 0;

        for (let i = 0; i < vector.length; i++) {
            let minIndex = i;

            for (let j = i + 1; j < vector.length; j++) {
                if (vector[j] < vector[minIndex]) {
                    minIndex = j;
                }
            }

            let temp = vector[i];
            vector[i] = vector[minIndex];
            vector[minIndex] = temp;

            if (i !== 0 && i % 2 === 1) {
                res += vector[i] - vector[i -1]
            }
        }

        console.log(res);
    };

    insertionSort(vector);
});

//////

let stdin = process.stdin;
stdin.setEncoding('utf8');
stdin.on('data', function (data) {
    let input = data.split('\n');
    let n = input[0].split(' ').map(function (a) { return parseInt(a); });
    let k = input[1].split(' ').map(function (a) { return parseInt(a); });
    let result = solution(n, k);
    console.log(result);
});

// End of interface

const solution = (n, studentsArray) => {
	let res = 0;
	studentsArray.sort(function(a, b){return a-b});
	for (let i = 0; i<n-1; i=i+2){
		res = res + (studentsArray[i+1]-studentsArray[i]);
	}
	return res;
};

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
rl.on('line', (input) => {
    if (l == 0) { l++ }
    else {
        rl.close();
        let strArray = input.split(" ")
        let s = strArray.map(function (item) {
            return parseInt(item, 10);
        });
        s = s.sort(function sortNumber(a, b) {
            return a - b;
        })
        let res = 0;
        for (let i = 0; i < input.length; i += 2) {
            let d = s[i + 1] - s[i]
            if (d > 0) {
                res += d
            }
        }
        console.log(res)
        return 0;
    }
});

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  list.sort(function(a,b){
  	return a - b;
  });
  var output = 0;
  for(var i = 0; i < N; i += 2){
    output += list[i + 1] - list[i];
  }
  myout(output);
}

let input ='';

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data',(data)=>input+=data)
process.stdin.on('end',()=>{
    let count = 0;
    let tmp = input.split('\n');
    let arr = tmp[1].split(' ').map((val)=>+val).sort((a,b)=>a-b);

    for(let i = 0; i < arr.length; i+=2){
        count+=Math.abs(arr[i]-arr[i+1])
    }
   console.log(count)
})

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const arr = d.split(' ').map(Number).sort((a, b) => a - b);
  let ans = 0;

  for (let i = 0; i < arr.length; i++) {
    if (i % 2) {
      ans += arr[i];
    }
    else {
      ans -= arr[i];
    }
  }

  console.log(Math.abs(ans));

  c++;
});

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  let l=0;
  rl.on('line', (input) => {
      if (l==0) {l++}
      else {
           rl.close();
           let strArray = input.split(" ")
           let s = strArray.map(function(item) {
            return parseInt(item, 10);
        });
           s = s.sort(function sortNumber(a,b) {
            return a - b;
        })
           let res=0;
           for(let i=0;i<input.length; i+=2){
            let d = s[i+1]-s[i]
            if(d>0) {
                res+=d
            }
        }
        console.log(res)
    return 0;
}
});

var n = +readline(), k = 0;
var arr = readline().split(' ').map(a => +a).sort((a,b) => a - b);
for(var i = 0; i < n - 1; i+=2) {
    k += arr[i + 1] - arr[i];
}
print(k);

let input = [];

const RL = require('readline').createInterface({
   input : process.stdin,
   output : process.stdout
});

RL.on('line', (line) => {
    input.push(line);
});

RL.on('close', () => {
    let n = parseInt(input[0]);
    let num = []; input[1].split(' ').forEach(i => num.push(parseInt(i)));
    num.sort((a, b) => a-b);
    let answer = 0;
    for(let i = 1; i < n; i+=2){
        answer += num[i]-num[i-1];
    }
    console.log(answer);
});

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .replace(/\s*$/, "")
    .split("\n")
    .map((str) => str.replace(/\s*$/, ""));

  main();
});

function readLine() {
  return inputString[currentLine++];
}

function main() {
  const nd = readLine().split(" ");
  const length = parseInt(nd[0], 10);
  const array = readLine()
    .split(" ")
    .map((aTemp) => parseInt(aTemp, 10));

  let count = 0;
  for (let i = 0; i < length - 1; i++) {
    for (let j = 1; j < length; j++) {
      if (array[j - 1] > array[j]) {
        [array[j - 1], array[j]] = [array[j], array[j - 1]];
      }
    }
  }
  for (let g = 0; g < array.length; g += 2) {
    if (array[g + 1] > array[g]) {
      count += array[g + 1] - array[g];
    }
  }
  console.log(count);
}

// sortTeams(length, students);

// const input = prompt("Friends");

// const meetFriends = () => {
//   let friends = input.split(" ");
//   let distance = 0;

//   for (let i = 1; i < friends.length; i++) {
//     let current = friends[i];

//     let index = i;

//     while (index >= 0 && current < friends[index - 1]) {
//       friends[index] = friends[index - 1];
//       index--;
//     }
//     friends[index] = current;
//   }
//   distance = friends[2] - friends[0];
//   console.log(distance);
// };

// meetFriends(input);

// const input1 = parseInt(prompt("First length"))
// const input2 = prompt("First text")
// const input3 = parseInt(prompt("Second length"))
// const input4 = prompt("Second text")

// const chooseTwoNumbers = () => {
//   let first = input2.split(" ");
//   let second = input4.split(" ");

//   for (let i = 1; i < input1; i++) {
//     let current = first[i];

//     let index = i;

//     while (index >= 0 && current < first[index - 1]) {
//       first[index] = first[index - 1];
//       index--;
//     }
//     first[index] = current;
//   }
//   for (let i = 1; i < input3; i++) {
//     let current = second[i];

//     let index = i;

//     while (index >= 0 && current < second[index - 1]) {
//       second[index] = second[index - 1];
//       index--;
//     }
//     second[index] = current;
//   }

//   if (
//     first[input1 - 1] >= second[input3 - 1] &&
//     first[0] >= second[input3 - 1]
//   ) {
//     console.log("YES");
//   } else if (first[input1 - 1] <= second[0] && first[0] <= second[0]) {
//     console.log("YES");
//   } else {
//     console.log("NO");
//   }
// };

// chooseTwoNumbers();

var n = readline(),
    a = readline().split(' ').map(v => +v);
a.sort((a,b) => a - b);
var s = 0;
while(n) {
    var m = 100,
        mi = 1;
    for(var i = 1; i < n; i++) {
        var lm = Math.abs(a[0] - a[i]);
        if(lm < m) {
            m = lm;
            mi = i;
        }
    }
    s += m;
    a.splice(mi, 1);
    a.splice(0, 1);
    n -= 2;
}
write(s);

//var input = readline()
var k = readline()

var n = readline().split(' ')
n.sort((a,b) => { return a - b })
//print(n)
//print(n[0]+' '+n[1])
var a = 0, b = 0
for(var i=0; i<k; i++) {
         if(i%2 == 0) {
            a += parseInt(n[i])
         }
         else {
            b += parseInt(n[i])
         }
     }
    // print(a+' '+b)
print(Math.abs(a-b))

//var input = readline()
var k = readline()

var n = readline().split(' ')
n.sort((a, b) => (a - b))

var a = 0, b = 0
for(var i=0; i<k; i+=2) {
     a += parseInt(n[i]);
}
for(var i=1; i<k; i+=2) {
    b += parseInt(n[i]);
}

print(Math.abs(a-b))

var n = readline();
var ni = readline().split(' ');
var output = 0;

for(var i=0; i<n; i++){
    ni[i] = parseInt(ni[i]);
}

ni = ni.sort(compareNumeric);

function compareNumeric(a, b) {
  if (a > b) return 1;
  if (a < b) return -1;
}

for(var i=0; i<n; i=i+2){

	output = output + ni[i+1] - ni[i];

}

print(output);

let input ='';

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data',(data)=>input+=data)
process.stdin.on('end',()=>{
    let count = 0;
    let tmp = input.split('\n');
    let arr = tmp[1].split(' ').map((val)=>+val).sort();

    for(let i = 0; i < arr.length; i+=2){
        count+=Math.abs(arr[i]-arr[i+1])
    }
   console.log(count)
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  let l=0;
  rl.on('line', (input) => {
      if (l==0) {l++}
      else {
           rl.close();
           let s = input.split(" ")
           s.sort()
           let res=0;
           for(let i=0;i<input.length; i+=2){
            let d = s[i+1]-s[i]
            if(d>0) {
                res+=d
            }
        }
        console.log(res)
    return 0;
}
});

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

    const input = lines[1];
    const vector = input.split(' ').map(
        n => parseInt(n)
    );

    const insertionSort = (vector) => {
        let res = 0;

        for (let i = 0; i < vector.length; i++) {
            let minIndex = i;

            for (let j = i + 1; j < vector.length; j++) {
                if (vector[j] < vector[minIndex]) {
                    minIndex = j;
                }
            }

            let temp = vector[i];
            vector[i] = vector[minIndex];
            vector[minIndex] = temp;

            if (i !== 0 && i % 2 === 1) {
                res += vector[i] - vector[i -1]
            }
        }

        console.log(res);
    };
});

//////

var n = readline(),
    a = readline().split(' ').map(v => +v);
var s = 0;
while(a.length) {
    var l = a.length,
        m = Infinity,
        mi = 1;
    for(var i = 1; i < l; i++) {
        var lm = Math.abs(a[0] - a[i]);
        if(lm < m) {
            m = lm;
            mi = i;
        }
    }
    s += m;
    a.splice(mi, 1);
    a.splice(0, 1);
}
write(s);


var data = readline().split(" "),
n = data[0],
a = data[1];

var homes = {
	odd: [],
	even: [],
};

for(var i=0;i<n;i++){
	if( i%2!=0 ){
		homes.even.unshift(i+1);
	} else {
		homes.odd.push(i+1);
	}
}

if( a%2 == 0 ){
	for( var i=0; i<homes.even.length; i++ ){
		if( homes.even[i] == a ) print(i+1);
	}
} else {
	for( var i=0; i<homes.odd.length; i++ ){
		if( homes.odd[i] == a ) print(i+1);
	}
}

		    var line = readline().split(' ');
			var n = line[0] ;
			var a = line[1] ;
			var result = 0 ;

			if (a%2 === 0) {
				result = -a/2+n/2+1 ;
			} else {
				result = a/2-0.5+1 ;
			}
			print(result) ;

var l = readline().split(' ');
var compute = function(n, a) {
    return (a % 2 === 0) ? (n - a) / 2 + 1 : (a + 1) / 2;
};
print(compute(+l[0],+l[1]));

var input = readline().split(" "),

    count = +input[0],
    target = +input[1],

    isEven = target % 2 == 0,

    time = isEven ? count / 2 - Math.floor(target / 2) + 1 : Math.floor(target / 2) + 1;

print(time);

var line = readline().split(' ');
var n = line[0];
var a = line[1];

if (a % 2) {
	var house = a;
} else {
	var house = n - a;
}

var res = Math.floor(house/2) + 1;

print(res);

var readInt = () => parseInt(readline())
var readIntArray = () => readline().split(' ').map(item => parseInt(item))
function range(a, b) {
    var res = []
    for (var i = a; i <= b; i++) {
        res.push(i)
    }
    return res
}

var inputData = readIntArray()
var n = inputData[0]
var a = inputData[1]
if (a % 2 !== 0) {
    print(Math.floor(a / 2) + 1)
} else {
    print(Math.floor((n-a) / 2) + 1)
}

var input = readline().split(" "),

    count = +input[0],
    target = +input[1],

    isEven = target % 2 == 0,

    time = isEven ? count - Math.floor(target / 2) - 1 : Math.floor(target / 2) + 1;

print(time);

var data = readline().split(" "),
	n = data[0],
	a = data[1];

var homes = [];

for(var i=0;i<n;i++){
	homes.push(i+1);
}

if( a%2 == 0 ){
	homes = homes.filter(v=>(v%2==0));

	for( var i=0; i<homes.length; i++ ){
		if( homes[i] == a ) print(i+2);
	}
} else {
	homes = homes.filter(v=>(v%2!=0)).reverse();

	for( var i=0; i<homes.length; i++ ){
		if( homes[i] == a ) print(i+2);
	}
}