var input = readline().split(' ').map(Number);

var n = input[0];
var t = input[1];

var smallest = "1";

for (i = 1; i < n; i++) {
	smallest += "0";
}

var R = 1;

for (j = 2; j <= n; j++) {
	R = (R * 10) % t;
}

String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index+character.length);
}

if (n == 1 && t == 10) {
	print("-1");
} else if (n == 1) {
	smallest = smallest.replaceAt(n - 1, String(t));
	print(smallest);
} else {
	if (R > 0) {
		smallest = smallest.replaceAt(n - 1, String(t - R));
		print(smallest);
	} else {
		print(smallest);
	}
}

var a = readline().split(" ").map(function(x) { return parseInt(x); });
var n = a[0], t = a[1];
var aa = Array(n).join('0')
if (t < 10) {
  print (t + aa);
} else if (n > 1){
  print (1 + aa);
} else {
  print (-1);
}

try {require('codef');} catch (e){global = this};
function readLineAsArray(separator){return readline().split(typeof separator == "undefined" ? ' ' : separator)}
function readLineAsIntegerArray(separator){return readLineAsArray(separator).map(function(v){return +v})}
Array.prototype.list = function() {var length = arguments.length; for(var i=0; i < length; i++){global[arguments[i]] = this[i]}};
String.prototype.repeat = function(n){return new Array(n + 1).join(this);}

readLineAsIntegerArray().list('n', 't');

write(n == 1 && t == 10 ? -1 : (n == 1 ? t : t * 2 + (t * 2 < 10 ? '0' : '') + ('0').repeat(n - 2)))

input = readline().split(" ").map(Number);
n = input[0];
t = input[1];
answer = "";
if (t == 10) {
	if (n == 1) {
		answer = "-1";
	} else {
		var answer = "1";
		for (var i = 1; i < n; i++)
			answer += "0";
	}
} else {
	for (var i = 0; i < n; i++)
		answer += t;
}
write(answer);

function main(){

var line = readline().split(' ').map(Number);

var n = line[0];
var t = line[1];

if(n===1){
    if(t===10){
	print(-1);
	return;
    }
    print(t);
    return;
}

var num = 1;

for(i=1;i<n;i++){
    num*=10;
    num%=t;
}

var str = '1';

for(i=1;i<n;i++){
    str+='0';
}

if(num===0){
    print(str);
    return;
}

var rem = t-num;

print(str.slice(0,-1)+rem.toString());

}

main();

"use strict";

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

var result = t < 10 ? new Array(n).fill(t).join('') : n > 1 ? '1' + new Array(n - 1).fill(0).join('') : -1;

write(result);

// var _i = 0;
//
// function readline() {
//     _i ++;
//
//     switch (_i) {
//         case 1: return '1 10';
//     }
// }
//
// function write(value) {
//     console.log(value);
// }

function getDigitsCount(n) {
    var res = 0;

    while (n > 0) {
        n = Math.floor(n / 10);
        res ++;
    }

    return res;
}

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

var n = parseInt(a[0]);
var t = parseInt(a[1]);

var m = getDigitsCount(t);
var ans;

if (n < m) {
    ans = -1;
} else {
    ans = t;

    for (var i = 0; i < n-m; i ++) {
        ans = ans + '0';
    }
}

write(ans);

var input = readline().split(' ').map(Number);
var n = input[0];
var t = input[1];
var i = 0;
var s = "";
if(n == 1 && t == 10) s += "-1";
else if(t == 10)
{
	s = "1";
	for(; i < n - 1; i++) s += "0";
}
else
{
	for(; i < n; i++) s += t;
}

print(s);

var isCodeForces = true;
var line, lines, echo;
if(!isCodeForces){
	lines = '';
	process.stdin.resume();
	process.stdin.on('data', function(buffer){lines += buffer.toString();});
	process.stdin.on('end', function(){
		lines = lines.trim().split('\n');
		echo = console.log;
		wrapper();
	});
}else{
	lines = [];
	while(line = readline()){
		lines.push(line);
	}
	echo = print;
	wrapper();
}

function wrapper(){
	init();
	var res = main();
	if(res != undefined){
		echo(res);
	}
}

function main(){
	var line = lines[0].split(' ');
	var a = parseInt(line[0]), b = parseInt(line[1]);
	if(b == 10){
		if(a <= 1)
			return -1;
		return '1' + new Array(a).join('0');
	}else{
		return new Array(a + 1).join(b + '');
	}
}

function init(){
}

var line=readline().split(' ');
var answer="";
if(line[1]>=2&&line[1]<10)
{
answer=line[1];
for(var i=0;i<(line[0]-1);i++) answer+="0";
print(answer);
}
else if(line[0]>1&&line[1]==10)
{
answer="1";
for(var i=0;i<(line[0]-1);i++) answer+="0";
print(answer);
}
else print("-1");

var input = readline().split(" ").map(Number), n = input[0], t = input[1];
var a = t, ans, arr = [1];

if((t + "").length > n){
	ans = -1;
}
else{
	for(var i = 1; i < 110; i++){
		arr[i] = 0;
	}

	if(t == 1 || t == 10){
		ans = arr.concat().splice(0,n).join("");
	}
	else{
		arr[0] = t;
		ans = arr.concat().splice(0,n).join("");
	}
}

write(ans);

var line = readline().split(' ')
var answer;
	if (line[0] == 1 && line[1] == 10) print("-1")
	else {
		if (line[1] == 10)
			answer = "1"
		else
			answer = line[1]
		for (var q = 1; q < line[0]; q++) {
			answer += "0"
		}
	}
if (answer != undefined) print(answer);

var s  = readline().split(" ");

var n = Number(s[0]), t = Number(s[1]);
var res = '';
if (t == 10) {
    if (n == 1) {
        res = '-1';
    }
    else {
        for(var i = 0; i <n-1; i++) {
            res = res + '1';
        }
        res = res + '0';
    }
}
else {
    for(var i=0; i<n; i++) {
        res = res + t;
    }
}
print(res);

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

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

readLine.on('close', () => {
  let [n, t] = input[0].split(' ').map(x => parseInt(x));
  let answer = [];
  if (n > 1) {
    for (let i = 0; i < n; i += 1) {
      if (i === 0) answer.push(t);
      else answer.push(0);
    }
    if (t === 10) answer.pop();
    console.log(answer.join(''));
  } else {
    if (t === 10 && n === 1) console.log(-1);
    else console.log(t);
  }
});

let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

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

function main() {
	const [n, t] = readLine()
		.split(' ')
		.map(x => x >> 0);

	if (n === 1 && t === 10) {
		console.log(-1);
	} else {
		if (t < 10) {
			console.log(`${t}${'0'.repeat(n - 1)}`);
		} else {
			console.log(`1${'0'.repeat(n - 1)}`);
		}
	}
}

/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}

/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	var List = __webpack_require__(1);
	var _a = List.map(parseInt, readline().split(' ')), n = _a[0], t = _a[1];
	function force(n) {
	    var upper = 10;
	    for (var i = 1; i < n; i++)
	        upper *= 10;
	    var lower = upper / 10;
	    for (var x = lower; x < upper; x++) {
	        if (x % t == 0)
	            return x;
	    }
	    return -1;
	}
	function construct(n) {
	    var digits = [];
	    var rem = 1;
	    digits.push(1);
	    for (var i = 1; i < n - 2; i++) {
	        digits.push(0);
	        rem = (rem * 10) % t;
	    }
	    rem = (rem * 100) % t;
	    var needed = (t - rem) % t;
	    digits.push(Math.floor(needed / 10));
	    digits.push(needed % 10);
	    return digits.join("");
	}
	var result = n < 3 ? "" + force(n) : construct(n);
	print(result);

/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {

	var Prelude_1 = __webpack_require__(2);
	function add(xs, ys) {
	    return xs.concat(ys);
	}
	exports.add = add;
	function head(xs) {
	    return xs[0];
	}
	exports.head = head;
	function last(xs) {
	    return xs[xs.length - 1];
	}
	exports.last = last;
	function tail(xs) {
	    return xs.slice(1);
	}
	exports.tail = tail;
	function init(xs) {
	    return xs.slice(0, xs.length - 1);
	}
	exports.init = init;
	function map(f, xs) {
	    var result = new Array(xs.length);
	    for (var i = 0; i < xs.length; i++) {
	        result[i] = f(xs[i]);
	    }
	    return result;
	}
	exports.map = map;
	function reverse(xs) {
	    return xs.slice().reverse();
	}
	exports.reverse = reverse;
	function intersperse(x, xs) {
	    if (xs.length == 0) {
	        return [];
	    }
	    var result = new Array(xs.length + xs.length - 1);
	    for (var i = 0; i + 1 < xs.length; i++) {
	        result[i + i] = xs[i];
	        result[i + i + 1] = x;
	    }
	    result[result.length - 1] = xs[xs.length - 1];
	    return result;
	}
	exports.intersperse = intersperse;
	function intercalate(xs, xss) {
	    return concat(intersperse(xs, xss));
	}
	exports.intercalate = intercalate;
	function foldl(f, initial, xs) {
	    var result = initial;
	    for (var i = 0; i < xs.length; i++) {
	        result = f(result, xs[i]);
	    }
	    return result;
	}
	exports.foldl = foldl;
	function foldr(f, initial, xs) {
	    var result = initial;
	    for (var i = xs.length - 1; i >= 0; i--) {
	        result = f(xs[i], result);
	    }
	    return result;
	}
	exports.foldr = foldr;
	function concat(xss) {
	    var total = sum(map(function (xs) { return xs.length; }, xss));
	    var result = new Array(total);
	    var m = 0;
	    for (var i = 0; i < xss.length; i++) {
	        var xs = xss[i];
	        for (var j = 0; j < xs.length; j++) {
	            result[m++] = xs[j];
	        }
	    }
	    return result;
	}
	exports.concat = concat;
	function sum(xs) {
	    var result = 0;
	    for (var i = 0; i < xs.length; i++) {
	        result += xs[i];
	    }
	    return result;
	}
	exports.sum = sum;
	function product(xs) {
	    var result = 1;
	    for (var i = 0; i < xs.length; i++) {
	        result *= xs[i];
	    }
	    return result;
	}
	exports.product = product;
	function sort(xs, compare) {
	    return copy(xs).sort(compare);
	}
	exports.sort = sort;
	function sortInPlace(xs, compare) {
	    xs.sort(compare);
	    return xs;
	}
	exports.sortInPlace = sortInPlace;
	function maximumInRange(xs, s, e) {
	    var result = xs[s];
	    for (var i = s + 1; i <= e; i++) {
	        if (result < xs[i])
	            result = xs[i];
	    }
	    return result;
	}
	exports.maximumInRange = maximumInRange;
	function maximum(xs) {
	    return maximumInRange(xs, 0, xs.length - 1);
	}
	exports.maximum = maximum;
	function maximumInRangeWith(xs, s, e, f) {
	    var result = f(xs[s]);
	    for (var i = s + 1; i <= e; i++) {
	        var candidate = f(xs[i]);
	        if (result < candidate)
	            result = candidate;
	    }
	    return result;
	}
	exports.maximumInRangeWith = maximumInRangeWith;
	function maximumWith(xs, f) {
	    return maximumInRangeWith(xs, 0, xs.length - 1, f);
	}
	exports.maximumWith = maximumWith;
	function minimumInRange(xs, s, e) {
	    var result = xs[s];
	    for (var i = s + 1; i <= e; i++) {
	        if (result > xs[i])
	            result = xs[i];
	    }
	    return result;
	}
	exports.minimumInRange = minimumInRange;
	function minimum(xs) {
	    return minimumInRange(xs, 0, xs.length - 1);
	}
	exports.minimum = minimum;
	function minimumInRangeWith(xs, s, e, f) {
	    var result = f(xs[s]);
	    for (var i = s + 1; i <= e; i++) {
	        var candidate = f(xs[i]);
	        if (result > candidate)
	            result = candidate;
	    }
	    return result;
	}
	exports.minimumInRangeWith = minimumInRangeWith;
	function minimumWith(xs, f) {
	    return minimumInRangeWith(xs, 0, xs.length - 1, f);
	}
	exports.minimumWith = minimumWith;
	function replicate(n, x) {
	    var result = new Array(n);
	    for (var i = 0; i < result.length; i++) {
	        result[i] = x;
	    }
	    return result;
	}
	exports.replicate = replicate;
	function take(n, xs) {
	    return xs.slice(0, n);
	}
	exports.take = take;
	function drop(n, xs) {
	    return xs.slice(n);
	}
	exports.drop = drop;
	function splitAt(n, xs) {
	    return [take(n, xs), drop(n, xs)];
	}
	exports.splitAt = splitAt;
	function takeWhile(f, xs) {
	    for (var i = 0; i < xs.length; i++) {
	        if (!f(xs[i])) {
	            return xs.slice(0, i);
	        }
	    }
	    return xs.slice();
	}
	exports.takeWhile = takeWhile;
	function dropWhile(f, xs) {
	    for (var i = 0; i < xs.length; i++) {
	        if (!f(xs[i])) {
	            return xs.slice(i);
	        }
	    }
	    return [];
	}
	exports.dropWhile = dropWhile;
	function group(xs) {
	    if (xs.length == 0)
	        return [];
	    var result = [];
	    var last = [xs[0]];
	    for (var i = 1; i < xs.length; i++) {
	        if (last[0] === xs[i]) {
	            last.push(xs[i]);
	        }
	        else {
	            result.push(last);
	            last = [xs[i]];
	        }
	    }
	    result.push(last);
	    return result;
	}
	exports.group = group;
	function nub(xs) {
	    if (xs.length == 0)
	        return [];
	    var result = [];
	    result.push(xs[0]);
	    for (var i = 1; i < xs.length; i++) {
	        if (xs[i] !== xs[i - 1]) {
	            result.push(xs[i]);
	        }
	    }
	    return result;
	}
	exports.nub = nub;
	function filter(f, xs) {
	    var result = [];
	    for (var i = 0; i < xs.length; i++) {
	        if (f(xs[i]))
	            result.push(xs[i]);
	    }
	    return result;
	}
	exports.filter = filter;
	function zip(xs, ys) {
	    var n = Prelude_1.min(xs.length, ys.length);
	    var result = new Array(n);
	    for (var i = 0; i < n; i++) {
	        result[i] = [xs[i], ys[i]];
	    }
	    return result;
	}
	exports.zip = zip;
	function unzip(xs) {
	    var r1 = new Array(xs.length);
	    var r2 = new Array(xs.length);
	    for (var i = 0; i < xs.length; i++) {
	        r1[i] = xs[i][0];
	        r2[i] = xs[i][1];
	    }
	    return [r1, r2];
	}
	exports.unzip = unzip;
	function range(from, to) {
	    var result = Array(to - from + 1);
	    for (var i = from; i <= to; i++) {
	        result[i - from] = i;
	    }
	    return result;
	}
	exports.range = range;
	function copy(xs) {
	    return xs.slice(0);
	}
	exports.copy = copy;
	function apply_permutation(p, xs) {
	    var n = xs.length;
	    var result = new Array(n);
	    for (var i = 0; i < n; i++) {
	        result[i] = xs[p[i]];
	    }
	    return result;
	}
	exports.apply_permutation = apply_permutation;
	function next_permutation(p) {
	    var n = p.length;
	    if (n < 2)
	        return null;
	    var r = copy(p);
	    var k = n - 2;
	    for (; k >= 0 && r[k] >= r[k + 1]; k--)
	        ;
	    if (k < 0)
	        return null;
	    for (var i = k + 1, j = n - 1; i < j; i++, j--) {
	        var t_1 = r[i];
	        r[i] = r[j];
	        r[j] = t_1;
	    }
	    var next = k + 1;
	    for (; r[next] <= r[k]; next++)
	        ;
	    var t = r[k];
	    r[k] = r[next];
	    r[next] = t;
	    return r;
	}
	exports.next_permutation = next_permutation;
	function create(n, value) {
	    return replicate(n, value);
	}
	exports.create = create;
	function createWith(n, f) {
	    var result = new Array(n);
	    for (var i = 0; i < n; i++) {
	        result[i] = f(i);
	    }
	    return result;
	}
	exports.createWith = createWith;
	function create2D(n1, n2, value) {
	    return map(function (_) { return replicate(n2, value); }, replicate(n1, 0));
	}
	exports.create2D = create2D;
	function create2DWith(n1, n2, f) {
	    var result = new Array(n1);
	    for (var i = 0; i < n1; i++) {
	        result[i] = new Array(n2);
	        for (var j = 0; j < n2; j++) {
	            result[i][j] = f(i, j);
	        }
	    }
	    return result;
	}
	exports.create2DWith = create2DWith;

/***/ },
/* 2 */
/***/ function(module, exports) {

	function min(a, b) {
	    return a < b ? a : b;
	}
	exports.min = min;
	function max(a, b) {
	    return a < b ? b : a;
	}
	exports.max = max;
	function curry(f) {
	    return function (x) { return function (y) { return f(x, y); }; };
	}
	exports.curry = curry;
	function uncurry(f) {
	    return function (x, y) { return f(x)(y); };
	}
	exports.uncurry = uncurry;
	function id(x) {
	    return x;
	}
	exports.id = id;
	function constant(x) {
	    return function (_) { return x; };
	}
	exports.constant = constant;
	function flip(f) {
	    return function (y) { return function (x) { return f(x)(y); }; };
	}
	exports.flip = flip;
	function flip2(f) {
	    return function (y, x) { return f(x, y); };
	}
	exports.flip2 = flip2;
	function compose(g, f) {
	    return function (x) { return g(f(x)); };
	}
	exports.compose = compose;
	function gcd(a, b) {
	    var r = a % b;
	    while (r !== 0) {
	        a = b;
	        b = r;
	        r = a % b;
	    }
	    return b;
	}
	exports.gcd = gcd;

/***/ }
/******/ ]);

var input = readline().split(' ').map(Number);

var n = input[0];
var t = input[1];

var smallest = "1";

for (i = 1; i < n; i++) {
	smallest += "0";
}

var R = 1;

for (j = 2; j <= n; j++) {
	R = (R * 10) % t;
}

String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index+character.length);
}

if (n == 1 && t == 10) {
	print("-1");
} else {
	if (R > 0) {
		smallest = smallest.replaceAt(n - 1, String(t - R));
		print(smallest);
	} else {
		print(smallest);
	}
}

var a = readline().split(" ");//readline();
var res = "";

		for (var i=0; i<Number(a[0]); i++){
			res+=a[1];
		}
	print(res.length==Number(a[0])? res:"-1");

var a = readline().split(" ");//readline();
var res = "";

		for (var i=0; i<Number(a[0]); i++){
			res+=a[1];
		}
	print(res);

var a = readline().split(" ");//readline();
var res = "1";

		while (res.length!=+a[0]){
			res+="1";
		}
		for (var i=0; i<100; i++){
			if (+res%2==0) break;
			else +res++;
		}
	print(+res%2==0? res: "-1");

var a =  readline().split(" ");//readline();
var res = "";

		for (var i=0; i<Number(a[0]); i++){
			res+=a[1];
			if (res.length==Number(a[0])) break;
		}
	 print(res.length==Number(a[0])? res:"-1");

var a = readline().split(" ").map(function(x) { return parseInt(x); });
var n = a[0], t = a[1];
var aa = Array(n).join('0')
if (t < 10) {
  print (t + aa);
} else {
  print (1 + aa);
}

try {require('codef');} catch (e){global = this};
function readLineAsArray(separator){return readline().split(typeof separator == "undefined" ? ' ' : separator)}
function readLineAsIntegerArray(separator){return readLineAsArray(separator).map(function(v){return +v})}
Array.prototype.list = function() {var length = arguments.length; for(var i=0; i < length; i++){global[arguments[i]] = this[i]}};
String.prototype.repeat = function(n){return new Array(n + 1).join(this);}

readLineAsIntegerArray().list('n', 't');
write(n < 2 && t > 5 ? '-1' : t * 2 + (t * 2 < 10 ? '0' : '') + ('0').repeat(n - 2));

var line = readline().split(' ').map(Number);

var n = line[0];
var t = line[1];

var num = Math.pow(10,n-1);

while(num%t !== 0){
    num+=1;
}

print(num);

function main(){

var line = readline().split(' ').map(Number);

var n = line[0];
var t = line[1];

if(n===1 && t===10){
    print(-1);
    return;
}

var num = 1;

for(i=1;i<n;i++){
    num*=10;
    num%=t;
}

var str = '1';

for(i=1;i<n;i++){
    str+='0';
}

if(num===0){
    print(str);
    return;
}

var rem = t-num;

print(str.slice(0,-1)+rem.toString());

}

main();

"use strict";

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

var result = -1;
for (var i = +('1' + new Array(n - 1).fill(0).join('')); ('' + i).length === n; ++i) {
    if (i % t === 0) {
        result = i;
        break;
    }
}

write(result);

X=readline().split(' ').map(Number)
if (X[0]==1&&X[1]==10)
 print(-1)
else
 print(X[1]+'0'.repeat(X[0]-1))

var input = readline().split(' ').map(Number);
var n = input[0];
var t = input[1];
var i = 0;

if(n == 1 && t == 10) print(-1);
else if(t == 10)
{
	print(1);
	for(; i < n - 1; i++) print(0);
}
else
{
	for(; i < n; i++) print(t);
}

var input = readline().split(' ').map(Number);
var n = input[0];
var t = input[1];
var i = 0;
var s = "";
if(n == 1 && t == 10) s += "-1";
else if(t == 10)
{
	print(1);
	for(; i < n - 1; i++) s += "0";
}
else
{
	for(; i < n; i++) s += t;
}

print(s);

var isCodeForces = true;
var line, lines, echo;
if(!isCodeForces){
	lines = '';
	process.stdin.resume();
	process.stdin.on('data', function(buffer){lines += buffer.toString();});
	process.stdin.on('end', function(){
		lines = lines.trim().split('\n');
		echo = console.log;
		main();
	});
}else{
	lines = [];
	while(line = readline()){
		lines.push(line);
	}
	echo = print;
	main();
}

function main(){
	init();
	var x = parseInt(lines[0]);
	echo(Math.ceil(x / 5));
}

function init(){
}

var isCodeForces = true;
var line, lines, echo;
if(!isCodeForces){
	lines = '';
	process.stdin.resume();
	process.stdin.on('data', function(buffer){lines += buffer.toString();});
	process.stdin.on('end', function(){
		lines = lines.trim().split('\n');
		echo = console.log;
		wrapper();
	});
}else{
	lines = [];
	while(line = readline()){
		lines.push(line);
	}
	echo = print;
	wrapper();
}

function wrapper(){
	init();
	var res = main();
	if(res != undefined){
		echo(res);
	}
}

function main(){
	line = lines[0].split(' ');
	var a = parseInt(line[0]), b = parseInt(line[1]);
	var c = Math.ceil(Math.pow(10, a - 1) / b);
	var res = c * b;
	if(Math.pow(10, a - 1) <= res && res < Math.pow(10, a))
		return res;
	res = (c + 1) * b;
	if(Math.pow(10, a - 1) <= res && res < Math.pow(10, a))
		return res;
	return -1;
}

function init(){
}

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

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

readLine.on('close', () => {
  let [n, t] = input[0].split(' ').map(x => parseInt(x));
  let answer = [];
  if (n > 1) {
    for (let i = 0; i < n; i += 1) {
      if (i === 0) answer.push(t);
      else answer.push(0);
    }

    console.log(answer.join(''));
  } else {
    if (t === 10 && n === 1) console.log(-1);
    else console.log(t);
  }
});

var input = readline().split(" ").map(Number), n = input[0], t = input[1];
var proof = true, a = t, ans;

if((t + "").length > n){
	ans = -1;
}
else{
	while(proof){
		if((a + "").length == n){
			proof = false;
			ans = a;
		}
		else{
			a *= t;
		}
	}
}

write(ans);

var input = readline().split(" ").map(Number), n = input[0], t = input[1];
var a = t, ans, arr = [1];

for(var i = 1; i < 110; i++){
	arr[i] = 0;
}

if(t == 1 || t == 10){
	ans = arr.concat().splice(0,n).join("");
}
else{
	arr[0] = t;
	ans = arr.concat().splice(0,n).join("");
}

write(ans);

var input = readline().split(" ").map(Number), n = input[0], t = input[1];
var a = t, ans, arr = [1];

for(var i = 1; i < 110; i++){
	arr[i] = 0;
}

if(t == 1){
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 2){
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 3){
	arr[n-1] = 2;
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 4){
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 5){
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 6){
	arr[n-1] = 2;
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 7){
	arr[0] = 7;
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 8){
	arr[n-1] = 8;
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 9){
	arr[n-1] = 8;
	ans = arr.concat().splice(0,n).join("");
}
else if(t == 10){
	ans = arr.concat().splice(0,n).join("");
}

write(ans);

var line = readline().split(' ')
	if (line[0] == 1 && line[1] == 10) print("-1")
	else {
		if (line[1] == 10)
			print("1");
		else
			print(line[1]);
		for (var q = 1; q < line[0]; q++) {
			print("0")
		}
	}

var line = readline().split(' ')
var answer;
	if (line[0] == 1 && line[1] == 10) print("-1")
	else {
		if (line[1] == 10)
			answer = "1"
		else
			answer = line[1]
		for (var q = 1; q < line[0]; q++) {
			answer += "0"
		}
	}
print(answer);


//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 list = nextIntArray();
	var sum = 0;
	for(var i = 0; i < N; i++){
		sum += Math.abs(list[i]);
	}
	myout(sum);
}

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

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

  const arr = d.split(' ').map(Number);
  let b = 0;
  let c = 0;

  for (let i = 0; i < arr.length; i++) {
    if (arr[i] < 0) {
      c += arr[i];
    }
    else {
      b += arr[i];
    }
  }

  console.log(b - c);

  count++;
});

readline();
var nums=readline().split(' ');
print(nums.filter(i=>i>=0).reduce((s,c)=>s+ (+c), 0)-nums.filter(i=>i<0).reduce((s,c)=>s+ (+c), 0));

(function() {
  readline();
  var elem = readline().split(' ').map(x => +x);

  print(solution(elem));
})();

function solution(elem) {
  var B = elem.filter(x => x > 0).reduce((s, v) => s + v, 0);
  var C = elem.filter(x => x < 0).reduce((s, v) => s + v, 0);

  return B - C;
}

const n = readline();
const input = readline();
const numbers = input.split(' ');

var result = 0;

for (var i = 0; i < n; i++){
    result += Math.abs(numbers[i]);
}

print(result);

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

var n = readline().split(' ')

var s = 0
for(var i=0; i<k; i++) {
    s += Math.abs(parseInt(n[i]))
}
print(s)

readline();
var sum = readline().split(' ').map(Number)
  .reduce((acc, d) => acc + (d < 0 ? -d : d), 0);
print(sum);

n=+readline()
res=0
a=readline().split(' ')
for (i=0;i<n;i++)
{
    if (a[i]<0){a[i]*=-1;}
    res+=+a[i];
}
print(res)

x=readline();
 y=(readline()).split(' ');
sum=0;
for(i=0;i<x;i++)
{
_y=parseInt(y[i])
if(_y<0)
    sum=sum+(-1*_y)
else
    sum=sum+_y
}
print(sum)

n=readline()
res=0
a=readline().split(' ')
for (i=0;i<n;i++)
{
    if (a[i]<0){a[i]*=-1;}
    res+=a[i];
}
print(res)

function main() {
  readLine();
  var sum = readLine().split(' ').map(Number)
    .reduce((acc, d) => acc + (d < 0 ? -d : d), 0);
  print(sum);
}


String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index+character.length);
}

readline();
var line = readline();
var c = 0;
for(var i = 0; i < line.length; i++) {
  c += (line.charAt(i) == 'x') ? 1 : 0;
}

var r = c - (line.length >> 1);
var R = Math.abs(r);

i = 0;
while (r > 0) {
  if (line.charAt(i) == 'x') {
    line = line.replaceAt(i, 'X');
    r--;
  } else {
    i++;
  }
}

i = 0;
while (r < 0) {
  if (line.charAt(i) == 'X') {
    line = line.replaceAt(i, 'x');
    r++;
  } else {
    i++;
  }
}

print(R);
print(line);

var n = parseInt(readline());
var str = readline();

var a = 0, b = 0;

for (var i = 0; i < str.length; ++i) {
  if (str[i] === 'x') {
    a++;
  } else {
    b++;
  }
}

String.prototype.replaceAt=function(index, character) {
  return this.substr(0, index) + character + this.substr(index+character.length);
}

var answ = 0;
if(a == b) {
  print(0);
  print(str);
} else {

  if (a > b) {
    for (; a > b+1; --a) {
      b++;
      answ++;
      str = str.replaceAt(str.indexOf('x'),'X');
    }
  } else {
    for (; a+1 < b; --b) {
      a++;
      answ++;
      str = str.replaceAt(str.indexOf('X'),'x');
    }
  }

  print(answ);
  print(str);
}

n = parseInt(readline())
var positions = readline()

var a = 0
var b = 0

for(var i = 0; i < positions.length; i++){
	if(positions[i] === "x"){
		a++
	}
	else{
		b++
	}
}

num = Math.abs(a-b)/2

print(num)

if(a > b){
	for(var i = 0; i < num; i++){
		positions = positions.replace("x", "X")
	}
}
else{
	for(var i = 0; i < num; i++){
		positions = positions.replace("X", "x")
	}
}

print(positions)

function trim(s) {
    return s.replace(/^\s+|\s+$/gm,'');
}
function tokenize(s) {
    return trim(s).split(/\s+/);
}
function tokenizeIntegers(s) {
    var tokens=tokenize(s);
    for(var i=0; i<tokens.length; ++i) {
        tokens[i]=parseInt(tokens[i], 10);
    }
    return tokens;
}
function main() {
    var hamsterNum = parseInt(readline());
    var hamsters = trim(readline());
    var sittingCount=0, standingCount=0;
    var parts = [], minutes = 0;
    for(var i=0; i<hamsterNum; ++i) {
        var hamster = hamsters.charAt(i);
        if(hamster == 'x') {
            sittingCount+=1;
            if(sittingCount>hamsterNum/2) {
                minutes+=1;
                parts.push('X');
                continue;
            }
        } else {
            standingCount+=1;
            if(standingCount > hamsterNum/2) {
                minutes+=1;
                parts.push('x');
                continue;
            }
        }
        parts.push(hamsters.charAt(i));
    }
    print(minutes);
    print(parts.join(''));
}
main();

;(function () {

	print(function (n) {
		var s = readline().split(''),
			m = {x: 0, X: 0, mx: n/2, mX: n/2},
			l = 0;

		s.forEach(function (e) { m[e]++; });

		var pos = -1;
		while (m.x !== m.mx && m.X !== m.mX) {
			l++;

			if (m.x < m.mx) {
				pos = s.indexOf('X', pos + 1);
				s[pos] = 'x'; m.x++; m.X--;
			} else {
				pos = s.indexOf('x', pos + 1);
				s[pos] = 'X'; m.X++; m.x--;
			}
		}

		return l + '\n' + s.join('');
	}(+readline()));

}.call(this));

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i], 10);
	};
	return tokens;
}

function main() {
	var hamsterNum = parseInt(readline());
	var hamsters = trim(readline());
	var sittingCount = 0, standingCount = 0;
	var parts = [], minutes = 0;
	for (var i = 0; i < hamsterNum; ++i) {
		var hamster = hamsters.charAt(i);
		if (hamster == 'x') {
			sittingCount += 1;
			if (sittingCount > hamsterNum/2) {
				minutes += 1;
				parts.push('X');
				continue;
			}
		}
		else {
			standingCount += 1;
			if (standingCount > hamsterNum/2 ) {
				minutes += 1;
				parts.push('x');
				continue;
			}
		}
		parts.push(hamsters.charAt(i));
	}
	print(minutes);
	print(parts.join(''));
}

main();

function main() {

    var n = Number(readline());

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

    var res=0;
    for(var i=0;i<n;i++){
        if(line[i]==="X"){
            res++;
        }
    }

    var diff=res-n/2;
    var res=Math.abs(diff);
    if(diff > 0){
        var j=0;
        while (diff>0 && j<n){
            if(line[j]==="X"){
                line[j]="x";
                diff--;
                j++;
            }else {
                j++;
            }
        }
    }else if(diff<0){
        j=0;
        diff=Math.abs(diff);
        while (diff>0 && j<n){
            if(line[j]==="x"){
                line[j]="X";
                diff--;
                j++;
            }else {
                j++;
            }
        }
    }

    print(res+'\n'+line.join(""));
}

main();

function trim(s) {
    return s.replace(/^\s+|\s+$/gm,'');
}
function tokenize(s) {
    return trim(s).split(/\s+/);
}
function tokenizeIntegers(s) {
    var tokens=tokenize(s);
    for(var i=0; i<tokens.length; ++i) {
        tokens[i]=parseInt(tokens[i], 10);
    }
    return tokens;
}
function main() {
    var hamsterNum = parseInt(readline());
    var hamsters = trim(readline());
    var sittingCount=0, standingCount=0;
    var parts = [], minutes = 0;
    for(var i=0; i<hamsterNum; ++i) {
        var hamster = hamsters.charAt(i);
        if(hamster == 'x') {
            sittingCount+=1;
            if(sittingCount>hamsterNum/2) {
                minutes+=1;
                parts.push('X');
                continue;
            }
        } else {
            standingCount+=1;
            if(standingCount > hamsterNum/2) {
                minutes+=1;
                parts.push('x');
                continue;
            }
        }
        parts.push(hamsters.charAt(i));
    }
    print(minutes);
    print(parts.join(' '));
}
main();

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i], 10);
	};
	return tokens;
}

function main() {
	var hamsterNum = parseInt(readline());
	var hamsters = trim(readline());
	var sittingCount = 0, standingCount = 0;
	var parts = [], minutes = 0;
	for (var i = 0; i < hamsterNum; ++i) {
		if (hamsters.charAt(i) == 'x') {
			sittingCount += 1;
		}
		else {
			standingCount += 1;
		}
		if (standingCount > hamsterNum/2) {
			minutes += 1;
			parts.push('x');
		}
		else if (sittingCount > hamsterNum/2) {
			minutes += 1;
			parts.push('X');
		}
		else {
			parts.push(hamsters.charAt(i));
		}
	}
	print(minutes);
	print(parts.join(''));
}

main();

var line = readline();
var c = 0;
for(var i = 0 ; i < line.length; i++) {
  c += (line.charAt(i) == 'x') ? 1 : 0;
}
print(c);
var r = c - (line.length >> 1);
print(Math.abs(r));

var line = readline();

var c = 0;
for(var i = 0 ; i < line.length; i++) {
  c += (line[i] == 'x') ? 1 : 0;
}

print(Math.abs(c - (line.length >> 1)));

var line = readline();

var c = 0;
for(var i = 0 ; i < line.length; i++) {
  c += (line[i] == 'x') ? 1 : 0;
}
print(c);
var r = c - (line.length >> 1);
print(Math.abs(r));

String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index+character.length);
}

var line = readline();
var c = 0;
for(var i = 0; i < line.length; i++) {
  c += (line.charAt(i) == 'x') ? 1 : 0;
}

var r = c - (line.length >> 1);
var R = Math.abs(r);

i = 0;
while (r > 0) {
  if (line.charAt(i) == 'x') {
    line = line.replaceAt(i, 'X');
    r--;
  } else {
    i++;
  }
}

i = 0;
while (r < 0) {
  if (line.charAt(i) == 'X') {
    line = line.replaceAt(i, 'x');
    r++;
  } else {
    i++;
  }
}

print("" + R);
print("" + line);

String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index+character.length);
}

var line = readline();
var c = 0;
for(var i = 0; i < line.length; i++) {
  c += (line.charAt(i) == 'x') ? 1 : 0;
}

var r = c - (line.length >> 1);
var R = Math.abs(r);

i = 0;
while (r > 0) {
  if (line.charAt(i) == 'x') {
    line = line.replaceAt(i, 'X');
    r--;
  } else {
    i++;
  }
}

i = 0;
while (r < 0) {
  if (line.charAt(i) == 'X') {
    line = line.replaceAt(i, 'x');
    r++;
  } else {
    i++;
  }
}

print(R);
print(line);

var n = parseInt(readline());
var str = readline();

var a = 0, b = 0;

for (var i = 0; i < str.length; ++i) {
  if (str[i] === 'x') {
    a++;
  } else {
    b++;
  }
}

String.prototype.replaceAt=function(index, character) {
  return this.substr(0, index) + character + this.substr(index+character.length);
}

var answ = 0;
if(a == b) {
  print(0);
  print(str);
} else {

  if (a > b) {

    for (; a > b+1; --a) {
      answ++;
      str = str.replaceAt(str.indexOf('x'),'X');
    }
  } else {
    for (; a+1 < b; --b) {
      answ++;
      str = str.replaceAt(str.indexOf('X'),'x');
    }
  }

  print(answ);
  print(str);
}

n = Number(readline())
positions = readline()

var a = 0
var b = 0

for(var i = 0; i < positions.length; i++){
	if(positions[i] === "x"){
		a++
	}
	else{
		b++
	}
}

print(Math.abs(a-b)/2)


var p = readline();
if(p){
	print((/[HQ9]/.test(p))? 'YES' : 'NO');
}else
	print('YES');

;(function () {

var a = readline();
if(a) print(/[HQ9]/.test(a) ? 'YES' : 'NO');
else print('YES');

}).call(this);

function check(str)
{
if (str === undefined) return "YES";
for (var i = 0; i < str.length; ++i) {
if (str[i] == "Q" || str[i] == "H" || str[i] == "9") return "YES";
}
return "NO";
}

var input = readline();
print(check(input));

var input = readline();
print(input?(input.match(/[HQ9]/)? "YES":"NO") : "YES");

      var word = readline(),
        isTrue = false;
      if (word == undefined) {
        print("YES");
      } else {
        word = word.split("");
        for (var i = 0; i < word.length; i++) {
          if (word[i] == "H" || word[i] == "Q" || word[i] == "9") {
            isTrue = true;
            break;
          } else {
            isTrue = false;
          }
        }

        if (isTrue) {
          print("YES");
        } else {
          print("NO");
        }
      }

var a = readline();
if(a){
	print( /[HQ9]/.test(a) ? 'YES' : 'NO');
}else{
	print('YES');
}

var p = readline();

if( (p == undefined) || p.indexOf("H")+1 || p.indexOf("Q")+1 || p.indexOf("9")+1  ){
	write("YES");
}
else{
	write("NO");
}

var word = readline();
print(word?(/[HQ9]/.test(word)?"YES":"NO"):"YES");

var a = readline();
if(a){
    print( /[HQ9]/.test(a) ? 'YES' : 'NO');
}else{
    print('YES');
}

var word = readline();
print( word ? ((word.indexOf('H') > -1 || word.indexOf('Q') > -1 || word.indexOf('9') > -1) ? 'YES' : 'NO') : 'YES');

var s=readline();

if(s)
    print((/[HQ9]/.test(s)) ? 'YES' : 'NO');
else
    print('YES');

var str = readline();
var bool = false;
if (str === undefined)
        write("YES\n");
else{
        var lng = str.length;
        for (var i = 0; i < lng; i++) {
           if( str[i] == "+" )
                      continue;
           if( str[i] == "H" || str[i] == "Q" || str[i] == 9){
                      bool = true;
                      break;
           }
  }
  if(bool)
           write("YES\n");
  else
           write("NO\n");
}

var str = readline();
if (str === undefined)
        write("YES\n");
else{
        var x = str.replace(/[HQ9]/, '');
        write(str.length > x.length ? "YES" : "NO");
}

var p = readline();
if(p)
	print((/[HQ9]/.test(p))? 'YES' : 'NO');
else
	print('YES');

// HQ9+ is a joke programming language which has only four one-character instructions:

//     "H" prints "Hello, World!",
//     "Q" prints the source code of the program itself,
//     "9" prints the lyrics of "99 Bottles of Beer" song,
//     "+" increments the value stored in the internal accumulator.

// Instructions "H" and "Q" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.

// You are given a program written in HQ9+. You have to figure out whether executing this program will produce any output.

// Input
// The input will consist of a single line p which will give a program in HQ9+. String p will contain between 1 and 100 characters, inclusive. ASCII-code of each character of p will be between 33 (exclamation mark) and 126 (tilde), inclusive.

// Output
// Output "YES", if executing the program will produce any output, and "NO" otherwise.

//if (readline().match(/H|Q|9/g)) {print("YES")}else {print("NO")}

var s = readline()
print(s?(s.match(/[HQ9]/)? "YES": "NO"): "YES")

//var n = readline().split(' ').map(Number);
var s = readline();
var ans = "NO";
if (s) {

    for (var i = 0; i < s.length; i++) {
        if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9') {
            var ans = "YES";
            break;
        }
    }
    print(ans);
}
else {
    print("YES");
}

a = readline();
print(a?(/[HQ9]/.test(a)?"YES":"NO"):"YES")

// wtf
var str = readline();
if (str) {
    var answer = "NO";
    for(var i = 0; i < str.length; i++){
        if(str[i]=== "H" || str[i] === 'Q' || str[i] === '9'){
            answer = "YES";
            break;
        }
    }
    print(answer);
} else {
    print("YES");
}

var string = readline();
var ans = "NO";
if(string){
    for (var i = 0; i < string.length; i++) {
        if (string[i]=='H'||string[i]=='Q'||string[i]=='9') {
            ans = "YES";
            break;
        }
    }
    if(string){
    print(ans);

    }
}
else{
    print("YES");
}

var str = readline();
if(str)
{
    var l = str.length;
    var second = true;
    for(var i = 0; i < l; ++i)
    {
        if(str[i] == "H" || str[i] == "Q" || str[i] == "9"){second = false;}
    }
    print(second ? "NO" : "YES");
}
else
{
    print("YES");
}

str = readline();
if(str)
	 print((/[HQ9]/.test(str))? "YES" : "NO" ) ;
 else
	 print("YES");

var line = readline();
print(line?(line.match(/[HQ9]/)? 'YES': 'NO'): 'YES');

var input = readline();
print(input?(input.match(/[HQ9]/)? 'YES': 'NO'): 'YES');

var rp = /[HQ9]/g;
var str = readline();

if (str)
rp.test(str)? print("YES"):print("NO")
else
print("YES");

var palabra = readline();
                var bola = false;
                if(palabra==undefined){
                    print("YES");
                }
                else{
                   for(var i=0;i<palabra.length;i++){
                if(palabra[i]=='H' || palabra[i]=='Q' || palabra[i]=='9'){

                    bola=true;
                    break;
                    }
                }

                if(bola)
                    print("YES");
                  else
                    print("NO");
                }

    var palabra = readline();
                var bola = false;
                if(palabra==undefined){
                    print("YES\n");
                }
                else{
                   for(var i=0;i<palabra.length;i++){
                if(palabra[i]=='H' || palabra[i]=='Q' || palabra[i]=='9'){

                    bola=true;
                    break;
                    }
                }

                if(bola)
                    print("YES\n");
                  else
                    print("NO\n");
                }

var input=readline();

try{
    var n=input.length;
}catch (e){
    input='Q';
    n=1;
}
var check=false;
for(var i=0;i<n;i++){
    if(input[i]=='H' || input[i]=='Q'||input[i]=='9')
    {
        check=true;
        break;
    }
}
if(check){
    print("YES");
}
else
    print("NO");

//133A - HQ9+
var program = readline();
try {
print((
        (program.indexOf("H") >= 0)
        || (program.indexOf("Q") >= 0)
        || (program.indexOf("9") >= 0)
    ) ? "YES" : "NO");
} catch (e) {
    print("YES");
}

var string = readline();
var ans = "NO";
if(string){
    for (var i = 0; i < string.length; i++) {
        if (string[i]=='H'||string[i]=='Q'||string[i]=='9') {
            ans = "YES";
            break;
        }
    }
    print(ans);
}
else{
    print("YES");
}

string = readline();
if (string == undefined) print("YES")
else if (/[HQ9]/.test(string)) print("YES");
else print("NO");

var tes = /[HQ9]/g;
var str = readline();

if (str)
tes.test(str)? print("YES"):print("NO")
else
print("YES");

const readline = require('readline');

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

rl.on("line", (answer) => {
	rl.close();
	console.log(/[HQ9]/g.test(answer) ? "YES" : "NO");
});

const readline = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
})
readline.question("",ans=>{
    if(ans.match(/[HQ9]/g))
        console.log("YES")
    else
        console.log("NO")
    readline.close()
})

/* ahsgdiojidqh iuwhu
Hqweuyquir
ljhfasQkajshd
osaufHlaksjd
Qaslkdhjasd */

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const str = readLine();

  if (str.includes("H") || str.includes("Q") || str.includes("9")) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const str = readLine();
  let countPlus = 0;
  const nums = str.split("").reduce((obj, char) => {
    if (char - char === 0) obj[char] = char;
    return obj;
  }, {});

  for (let i = 0; i < str.length; i++) {
    if (str[i] === "+") countPlus++;
  }

  Object.keys(nums).forEach((key) => {
    nums[key] = +nums[key] + countPlus;
  });

  if (str.includes("H") || str.includes("Q") || str.includes("9")) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}

// Alternative
// https://www.npmjs.com/package/competitive-programming-js
"use strict"

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.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});
function readline() { return inputString[currentLine++]; }
const println = (x = "") => process.stdout.write(String(x) + "\n");
const print = x => { process.stdout.write(String(x)); }
// >>>>>>>>>>>>> Main starts here <<<<<<<<<<<<<<

function main() {
    let s = readline();
    let f = 0;
    if (s.includes("H")) f = 1;
    if (s.includes("Q")) f = 1;
    if (s.includes("9")) f = 1;
    println(f ? "YES" : "NO");
}

const input = readline()

if(input) {
    const output = /[HQ9]/.test(input)
    print(output ? 'YES': 'NO')
} else {
    print('YES')
}

//HQ9+

const {EOL} = require('os');

let inp = '';

process.stdin.on('data', c => inp += c);

process.stdin.on('end', () => {
    let lines = inp.split(EOL)[0];

    for(let i in lines)  {
    	if('HQ9'.indexOf(lines[i]) != -1)  {
    		process.stdout.write("YES");
    		return;
    	}
    }

    process.stdout.write("NO");
    return;
});

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

rl.on('line', (str) => {
  if (/[HQ9]/.test(str)) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});

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

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

readLine.on('close', () => {
  let str = input[0];

  for (let i = 0; i < str.length; i += 1) {
    if (str[i] === 'H' || str[i] === 'Q' || str[i] === '9') {
      console.log('YES'); process.exit();
    }
  }

  console.log('NO');
});

var s = readline();
if (s === undefined) print('YES');
else {
var x = s.replace(/[HQ9]/, '');
print(s.length > x.length? 'YES': 'NO');
}

let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

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

function isPrime(x) {
	let s = Math.sqrt(x);
	let i = 2;
	while (i <= s) {
		if (x % i === 0) {
			return false;
		}
		i++;
	}
	return true;
}

function main() {
	let prog = readLine().split('');
	let grammar = {
		H: true,
		Q: true,
		9: true,
	};

	let flag = false;

	for (let i = 0, l = prog.length; i < l; ++i) {
		if (grammar[prog[i]]) {
			flag = true;
			break;
		}
	}
	flag ? console.log('YES') : console.log('NO');
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let word = readLine();
    if (word.includes('H') || word.includes('Q') || word.includes('9')) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}

let fs = require('fs')

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter(data => {
    return data.length > 0
});
for (let i = 0; i < txt.length; i ++) {
    doit(txt[i])
}

function doit(str) {

    if(str.match("H")!=null || str.match("Q")!=null || str.match("/\+/")!=null || str.match("9")!=null){
        console.log("YES");
    }else{
        console.log('NO');

    }
}

var input = readline();
if (input){
if (input.toString().match(/[HQ9]/)){
    print("YES");
} else print("NO")} else print("YES");

var linea = new String(readline());
if (linea.length>1) {
    linea = linea.substring(0, linea.length - 1);
}

var res;
var centinela = false;

if (linea.charAt(0)=='k' || linea.charAt(0)=='K') {
    centinela = true;
}else if (linea.lastIndexOf('H') != -1 || linea.lastIndexOf('Q') != -1 || linea.lastIndexOf('9') != -1 || linea.indexOf("\\")!=-1)  {
    centinela = true;

}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

print(res);

var rp = /[HQ9+]/g;
var r = /[=+]\w/g;
var str = readline();

if (rp.test(str)&&r.test(str)===false)
	print ("YES");
else
	print ("NO");

var word = readline();
print((word.replace(/HQ9+/,"")==word)?
    "YES":"NO");

var line = readline();
print(line?(line.match(/[HQ9]/)? 'YES': 'NO'): 'NO');

var instruction = readline()
  var result = 'NO'

  var validInstructions = /[HQ9]/

  result = validInstructions.test(instruction) ? 'YES' : 'NO'

  print(result)

var rp = /[HQ9+]/g;
var str = readline();

if (rp.test(str))
	print("YES");
else
	print("NO");

str = readline();
if(str.charAt(0) == "H" || str.charAt(0) == "Q" || str.charAt(0) == "9" || str.charAt(0) == "+")
{print("YES");}
else{print("NO");}

b = readline();

if( b.indexOf('H') == 0 || b.indexOf('Q') == 0 || b.indexOf('9') == 0 || b.indexOf('+') == 0   ) {

    print('YES')
}
else {
     print('NO')

}

var rp = /[HQ9]/g;
var str = readline();

if (rp.test(str))//&&r.test(str)===false)
	print("YES");
else
	print("NO");

var linea = new String(readline());
//var linea = "lkjsdhgfskfghilskfh9g";
var res;
var centinela = false;

if (linea.indexOf('H') != -1 || linea.indexOf('Q') != -1 || linea.indexOf('9') != -1)  {
    centinela = true;
} else if (linea.charAt(0) == 'k') {
    centinela == true;
}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

//alert(res)
print(res);

function check(str)
{
    for (var i = 0; i <= str.length - 1; i++)
    {
        if ((str[i] === 'H') || (str[i] === 'Q') || (str[i] === '9') || (str[i] === '+') ) return "YES";
    }
    return "NO";
}

{
    var input = readline();
    print(check(input));
}

var rp = /[HQ9+]\w/g;
var r = /=/g;
var str = readline();

if (str.length>1&&rp.test(str)&&r.test(str)===false)
	print("YES");
else
	print("NO");

var input = "CODE!";
print(input ? (input.match(/[HQ9]/)? "YES":"NO"):"YES");

const input = readline()
const output = input.match(/[HQ9]/g)
print(output)

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

rl.on('line', (str) => {
  if (/[HQ0-9+]/.test(str)) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});

const input = readline() || ''
const output = input.match(/[HQ9]/g) ? 'YES': 'NO'
print(output)

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

rl.on('line', (str) => {
  if (/[HQ0-9]/.test(str)) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});

        function main()
        {
            var str = readline();
            var l = str.length;
            for(var i = 0; i < l; ++i)
            {
                if(str[i] == "H" || str[i] == "Q" || str[i] == "9"){print("YES"); return 0;}
            }
            print("NO");
        }

var palabra = readline();
var bola = false;
for(var i=0;i<palabra.length;i++){
if(palabra[i]=='H' || palabra[i]=='Q' || palabra[i]=='9'){

    bola=true;
    break;
    }
    else{
        bola=false;
    }
}
if(bola==false){
    print("NO");
}   else{
    print=("YES");
}

var linea = new String(readline());
var res;
var centinela = false;

if (linea.indexOf('H') != -1 || linea.indexOf('Q') != -1 || linea.indexOf('9') != -1 || linea.indexOf('a')==2)  {
    centinela = true;
}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

print(res);

var string = readline();
if (string.includes("H") || string.includes("Q") ||
string.includes("9") || string.includes("+")) print("YES");
else print("NO");

var rp = /[HQ9+]/g;
var r = /=/g;
var str = readline();

if (rp.test(str)&&r.test(str)==false)
	print("YES");
else
	print("NO");

//var linea = readline().toString();
var linea = new String(readline());
//var linea = "lkjsdhgfskfghilskfh9g";
var res;
var centinela = false;

if (linea.indexOf('H') != -1 || linea.indexOf('Q') != -1 || linea.indexOf('9') != -1)  {
    centinela = true;
}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

//alert(res)
print(res);

var palabra = readline().toUpperCase();
var contador=0;
for(var i=0;i<palabra.length;i++){
    if(palabra[i]=="H" || palabra[i]=="Q" || palabra[i]=="9"){
        contador++;
    }
}

if(contador>0){
    print("YES");
}else{
    print("NO");
}

string = readline();
if (/[HQ9]/.test(string)) print("YES");
else print("NO");

var word = readline();
print((word.indexOf('H') > -1 || word.indexOf('Q') > -1 || word.indexOf('9') > -1 || word.indexOf('+') > -1) ? 'YES' : 'NO');

b = readline();

if( b.indexOf('H') != -1 || b.indexOf('Q') != -1 || b.indexOf('9') != -1 || b.indexOf('+') != -1   ) {

    print('YES')
}
else {
     print('NO')

}

var s=readline();
var answer;
print(s.split('').filter(function(x){if(x === 'H'|| x === 'Q' || x === 9 || x === '+'){answer === 'YES'}else{answer === 'NO'} return answer; }))

var line = readline();
print(line?(line.match(/[HQ9]/)? 'YES': 'NO'): 'NO');

var rp = /[HQ9+]/g;
var str = readline();

if (rp.test(str))
	print("YES");
else
	print("NO");

var palabra = readline();
for(var i=0;i<palabra.length;i++){
if(palabra[i]=="H" || palabra[i]=="Q" || palabra[i]=="9" || palabra[i]=="+"){
    print("YES");
    break;
    }else{
         print("NO");
        }
    }

var palabra = readline();
var bola = true;
for(var i=0;i<palabra.length;i++){
if(palabra[i]=="H" || palabra[i]=="Q" || palabra[i]=="9"){
    print("YES");
    break;
    }
    else{
        bola=false;
    }
}
if(bola==false){
    print("NO");
}

var str = readline();
var bool = false;
for (var i = 0; i < str.length; i++) {
         if( str[i] == "H" || str[i] == "Q" || str[i] == 9 || str[i] == '+'){
                    bool = true;
                    break;
         }
}
if(bool)
         write("YES\n");
else
         write("NO\n");

const input = readline()
const output = /^[HQ9]+$/.test(input) ? 'YES': 'NO'
print(output)

var linea = new String(readline());
if (linea.length>1) {
    linea = linea.substring(0, linea.length - 1);
}

var res;
var centinela = false;

if (linea.charAt(0)=='k' || linea.charAt(0)=='K') {
    centinela = true;
} else if (linea.lastIndexOf('H') != -1 || linea.lastIndexOf('Q') != -1 || linea.lastIndexOf('9') != -1 || linea.indexOf("Kba")!=-1)  {
    centinela = true;

}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

print(res);

var rp = /[HQ9]/g;
var str = readline();

if (rp.test(str))//&&r.test(str)===false)
	print("YES");
else
	print("NO");

var instruction = readline()
  var result = 'YES'

  var validInstructions = /[HQ9]/

  result = validInstructions.test(instruction) ? 'YES' : 'NO'

  print(result)

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const str = readLine();
  let countPlus = 0;
  const nums = str.split("").reduce((obj, char) => {
    if (char - char === 0) obj[char] = char;
    return obj;
  }, {});

  for (let i = 0; i < str.length; i++) {
    if (str[i] === "+") countPlus++;
  }

  Object.keys(nums).forEach((key) => {
    nums[key] = +nums[key] + countPlus;
  });

  if (str.includes("H") || str.includes("Q") || str.includes("9") || Object.values(nums).includes(9)) {
    console.log("YES");
  } else {
    console.log("NO");
  }
}

var s=readline();

if(s){
    print((/[HQ9]/.test(s)) ? 'YES' : 'NO');
}

var word = readline();
print(/(H|Q|9|\+)/.test(word) ? "YES":"NO");

var string = readline();
if (string.includes("H") || string.includes("Q")) print("YES");
else print("NO");

var rp = /[HQ9+]\w/g;
var r = /=/g;
var str = readline();

if (rp.test(str)&&r.test(str)==false&&str.length>1)
	print("YES");
else
	print("NO");

            var palabra = readline();
            var bola = false;
            if(palabra==undefined){
                print="YES";
            }
            else{
               for(var i=0;i<palabra.length;i++){
            if(palabra[i]=='H' || palabra[i]=='Q' || palabra[i]=='9'){

                bola=true;
                break;
                }
            }

            if(bola)
                print("YES");
              else
                print("NO");
            }

string = readline();
if (/[HQ9]/.test(string)) print("YES");
else print("NO");

const input = readline()
const output = /[HQ9]/.test(input) ? 'YES': 'NO'
print(output)

var linea = new String(readline());
var res;
var centinela = false;

if (linea.indexOf('H') != -1 || linea.indexOf('Q') != -1 || linea.indexOf('9') != -1 || linea.indexOf("'")!=-1)  {
    centinela = true;
}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

print(res);

var linea = readline().toString();
//var linea = "lkjsdhgfskfghilskfh9g";
var res;
var centinela = false;
var str="";
for (var i = 0; i < linea.length; i++){
    str += linea[i];
}
if (str.match(/HQ9/g)!=null) {
    centinela = true;
}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

//alert(res)
print(res);

function check(str)
{
    if ((str.indexOf('H') !== -1) || (str.indexOf('Q') !== 11) || (str.indexOf('9') !== -1)) return "YES";
    else return "NO";
}

{
    var input = readline();
    print(check(input));
}

if(readline().replace(/[^HQ9+]/,"").length>0){
    print("YES");
}
else
    print("NO");

b = readline();

// print(  b.indexOf('+') + ' : ' +  b.indexOf('H')  + ' : ' +  b.indexOf('Q') + ' : ' + b.indexOf('9'))

if( b.indexOf('H') != -1 || b.indexOf('Q') != -1 || b.indexOf('9') != -1  ) {
    if( b.indexOf('+') >  b.indexOf('H') && b.indexOf('+')  >  b.indexOf('Q') && b.indexOf('+')  >  b.indexOf('9') )
  {
    print('YES')

  }
  else {
      print('NO')
  }
}

else {
     print('NO')

}

var instruction = readline()
  var result = 'NO'

  var validInstructions = /[HQ9]/

  result = validInstructions.test(instruction) ? 'YES' : 'NO'

  print(result)

var linea = new String(readline());
if (linea.length>1) {
    linea = linea.substring(0, linea.length - 1);
}

var res;
var centinela = false;

if (linea.charAt(0)=='k' || linea.charAt(0)=='K') {
    centinela = true;
}else if (linea.lastIndexOf('H') != -1 || linea.lastIndexOf('Q') != -1 || linea.lastIndexOf('9') != -1 || linea.indexOf("\?")!=-1)  {
    centinela = true;

}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

print(res);

const input = readline() || ''
const output = input.match(/[HQ9]/g) ? 'YES': 'NO'
print(output)

print( /[HQ9]/.test(readline()) ? 'YES' : 'NO');

var input = "CODE!";
print(input ? (input.match(/[HQ9]/)? "YES":"NO"):"YES");

str = readline();
if(str.charAt(0) == "H" || str.charAt(0) == "Q" || str.charAt(0) == "9")
{print("YES");}
else{print("NO");}

;(function () {

	print(/[HQ9]/.test(readline()) ? 'YES' : 'NO');

}).call(this);

var s=readline();
var answer;
(function(){print(s.split('').filter(function(x){if(x === 'H'|| x === 'Q' || x === 9 || x === '+'){answer === 'YES'}else{answer === 'NO'} return answer; }))}).call(this);

var linea = new String(readline());
var res;
var centinela = false;

if (linea.charAt(0)=='k' || linea.charAt(0)=='K') {
    centinela = true;
}else if (linea.lastIndexOf('H') != -1 || linea.lastIndexOf('Q') != -1 || linea.lastIndexOf('9') != -1 || linea.lastIndexOf("'")!=-1)  {
    centinela = true;

}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

print(res);

var str = readline();
var ansver = "NO";
for(var i = 0; i < str.length; i++){
    if(str[i]=== "H" || str[i] === 'Q' || str[i] === '9' || str[i] === '+'){
        ansver = "YES";
    }
}
print(ansver);

var string = readline();
if (string.includes("H") || string.includes("Q") ||
string.includes("9") || string.includes("+")) print("YES");
else print("NO");

string = readline();
if (/[HQ9]/.test(string)) print("YES");
else print("NO");

var s=readline();

var w= s.split('');

if(w==='h'.toUpperCase() || w==='q'.toUpperCase() || w==='9' || w==='+'){
    print('YES');
}else{
    print('NO');
}

var word = readline();
print((word.replace(/HQ9+/,"")==word)?
    "YES":"NO");

var input = readline();
if (input){
if (input.toString().match(/[HQ9]/)){
    print("YES");
} else print("NO")} else print("NO");

    var palabra = readline();
                    var bola = false;
                    if(palabra==undefined){
                        print("YES");
                    }
                    else{
                       for(var i=0;i<palabra.length;i++){
                    if(palabra[i]=='H' || palabra[i]=='Q' || palabra[i]=='9'){

                        bola=true;
                        break;
                        }
                    }

                    }
                    if(bola)
                        print("YES");
                      else{
                        print("NO");
                    }

var input = readline();
if (input.match(/[H,Q,9]/)){
    print("YES");
} else print("NO");

var palabra = readline();
var bola = true;
for(var i=0;i<palabra.length;i++){
if(palabra[i]=="H" || palabra[i]=="Q" || palabra[i]=="9" || palabra[i]=="+"){
    print("YES");
    break;
    }
    else{
        bola=false;
    }
}
if(bola==false){
    print("NO");
}

const input = readline()

if(input) {
    const output = /[HQ9]/.test(input)
    print(output ? 'YES': 'NO')
}

function check(str)
{
    str = str.split('H', 'Q', '9');
   if (str.length > 1) return "YES";
   else return "NO";
}

{
    var input = readline();
    print(check(input));
}

var rp = /[HQ9+]\w/g;
var r = /=/g;
var str = readline();

if (rp.test(str)&&r.test(str)===false)
	print("YES");
else
	print("NO");

var linea = new String(readline());
//var linea = "lkjsdhgfskfghilskfh9g";
var res;
var centinela = false;

if (linea.match(/[HQ9]/g)!=null) {
    centinela = true;
}
if (centinela) {
    res = 'YES'
} else {
    res = 'NO'
}

//alert(res)
print(res);

const input = readline()
const output = /^[HQ9]+$/.test(input) ? 'YES': 'NO'
print(output)

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

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

readLine.on('close', () => {
  let str = input[0];

  for (let i = 0; i < str.length; i += 1) {
    if (str[i] === 'H' || str[i] === 'Q' || str[i] === '9' || str[i] === '+') {
      console.log('YES'); process.exit();
    }
  }

  console.log('NO');
});

var input = readline();
if (input.match(/[H,Q,9,+]/gi)){
    print("YES")
} else print("NO")

str = readline();
if(str.charAt(0) == "H" || str.charAt(0) == "Q" || str.charAt(0) == "9")
{print("YES");}
else{print("NO");}

var s=readline();
var answer;
var w = s.split('').filter(function(x){if(x === 'H'|| x === 'Q' || x === 9 || x === '+'){answer === 'YES'}else{answer === 'NO'} return answer; });
print(w);

var linea=readline();
//var numbers = readline().split(" ").map(function (x) { return parseInt(x); });
var centinel = false;
var cadena = linea.split("");
var res;
for (var i = 0; i < cadena.length; i++){
    if (cadena[i] == 'H' || cadena[i] == 'Q' || cadena[i] == '+' || cadena[i] == '9') {
        centinel = true;
        break;
    }
}
if (centinel) {
    res = 'YES';
} else {
    res = 'NO';
}
print(res);


str = readline().split(' ').map(Number);

var l = str[0], r = str[1], a = str[2];

while (a !== 0) {
	if (l > r) {
		r++;
		a--;
	} else if (l < r) {
		l++;
		a--;
	} else if (l == r && a > 1) {
		var x = Math.floor(a / 2);
		l = l + x;
		r = r + x;
		break;
	} else {
		break;
	};
};

print(Math.min(l, r) * 2);

//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 one = nextIntArray();
	var L = one[0];
	var R = one[1];
	var C = one[2];
	if(Math.abs(L - R) >= C){
		myout((Math.min(Math.max(L, R), Math.min(L, R) + C)) * 2);
	}else{
		var diff = Math.abs(L - R);
		if(L > R){
			R += diff;
		}else{
			L += diff;
		}
		C -= diff;
		myout((Math.floor(C / 2) + L) * 2);
	}
}

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

rl.on('line', (d) => {
  let [l, r, a] = d.split(' ').map(Number);
  let ans = 0;

  while (l < r && a !== 0) {
    l++;
    a--;
  }

  while (r < l && a !== 0) {
    r++;
    a--;
  }

  ans += Math.min(l, r) * 2;
  ans += Math.floor(a / 2) * 2;

  console.log(ans);
});

var input = readline()
var l = parseInt(input.split(' ')[0], 10);
var r = parseInt(input.split(' ')[1], 10);
var a = parseInt(input.split(' ')[2], 10);

var finalized = false;
function foo(l, r, a) {

    var finalize = function (l, r, a) {
        if (!finalized) {
            finalized = true;
            while (a - 2 >= 0) {
                l++;
                r++
                a -= 2;
            }

            if (!((l + r) % 2)) {
                //tea
                print(l + r)
                //console.log(l + r)
            }
            else {
                print((--l + --r))
                // console.log((--l + --r))
            }
        }
    }

    if (l < r) {
        while (l < r) {
            if (a) {
                l++;
                a--
            }
            else {

                if (l != r) {
                    foo(l, --r, a);
                }
                else {
                    foo(l, r, a)

                }
                break;
            }
        }

        if (r == l) {
            foo(l, r, a)
        }

    }
    else if (l > r) {
        while (r < l) {
            if (a) {
                r++;
                a--;
            }
            else {
                if (r != l) {
                    foo(--l, r, a);
                }
                else {
                    foo(l, r, a)

                }
                break;
            }
        }

        if (r == l) {
            foo(l, r, a)
        }

    }
    else if (l == r) {
        finalize(l, r, a)
    }

}

// foo(1, 4, 2)
// foo(5, 5, 5)
// foo(0, 2, 0)
// foo(89, 44, 77)
foo(l, r, a);

var input = readline()
var l = parseInt(input.split(' ')[0], 10);
var r = parseInt(input.split(' ')[1], 10);
var a = parseInt(input.split(' ')[2], 10);

var finalized = false;
function foo(l, r, a) {

    var finalize = function (l, r, a) {
        if (!finalized) {
            finalized = true;
            while (a - 2 >= 0) {
                l++;
                r++
                a -= 2;
            }

            if (!((l + r) % 2)) {

                print(l + r)
                //console.log(l + r)
            }
            else {
                print((--l + --r))
                // console.log((--l + --r))
            }
        }
    }

    if (l < r) {
        while (l < r) {
            if (a) {
                l++;
                a--
            }
            else {

                if (l != r) {
                    foo(l, --r, a);
                }
                else {
                    foo(l, r, a)

                }
                break;
            }
        }

        if (r == l) {
            foo(l, r, a)
        }

    }
    else if (l > r) {
        while (r < l) {
            if (a) {
                r++;
                a--;
            }
            else {
                if (r != l) {
                    foo(--l, r, a);
                }
                else {
                    foo(l, r, a)

                }
                break;
            }
        }

        if (r == l) {
            foo(l, r, a)
        }

    }
    else if (l == r) {
        finalize(l, r, a)
    }

}

// foo(1, 4, 2)
// foo(5, 5, 5)
// foo(0, 2, 0)
// foo(89, 44, 77)
foo(l, r, a);

var input = readline()
var l = parseInt(input.split(' ')[0], 10);
var r = parseInt(input.split(' ')[1], 10);
var a = parseInt(input.split(' ')[2], 10);

function foo(l, r, a) {

    var finalize = function (l, r, a) {

        while (a - 2 >= 0) {
            l++;
            r++
            a -= 2;
        }

        if (!((l + r) % 2)) {
            //tea
            print(l + r)
            // console.log(l + r)
        }
        else {
            print((--l + --r))
            // console.log((--l + --r))
        }
    }

    if (l < r) {
        while (l <= r) {
            if (a) {
                l++;
                a--
            }
            else {

                if (l != r) {
                    foo(l, --r, a);
                }
                else {
                    foo(l, r, a)

                }
                break;
            }
        }

    }
    else if (l > r) {
        while (r <= l) {
            if (a) {
                r++;
                a--;
            }
            else {
                if (r != l) {
                    foo(--l, r, a);
                }
                else {
                    foo(l, r, a)

                }
                break;
            }
        }

    }
    else if (l == r) {
        finalize(l, r, a)
    }

}

//foo(0, 2, 0)
foo(l, r, a);