var  dpf = new Array(101);
var dph = new Array(101);
var n1, n2, k1, k2, input;
var M = 100000000;

for (var i = 0; i < 101; i++) {
    dpf[i] = new Array(101).fill(-1);
    dph[i] = new Array(101).fill(-1);
}

input = readline();

n1 = Number(input.split(" ")[0]);n2 = Number(input.split(" ")[1]);
k1 = Number(input.split(" ")[0]);k2 = Number(input.split(" ")[0]);

print((footMan(n1, n2) + horseMan(n1, n2)) % M);

function footMan(f, h) {
    // footman을 먼저 세우기 시작하여 배치할 수 있는 모든 경우의 수
    if (f == 0) {// 풋맨이 더 이상 없다면
        return (h == 0) ? 1 : 0;
    }
    var ret = dpf[f][h];
    if (ret != -1) {
        return ret;
    }
    var sum = 0;
    for (var i = 1; i <= min(k1, f); i++) {
        sum += horseMan(f - i, h);
        sum  %= M;
    }
    return sum;

}
function horseMan(f, h) {
    // horseman을 먼저 세우기 시작하여 배치할 수 있는 모든 경우의 수
    if (h == 0) {// 홀스맨이 더 이상 없다면
        return (f == 0) ? 1 : 0;
    }
    var ret = dph[f][h];
    if (ret != -1) {
        return ret;
    }
    var sum = 0;
    for (var i = 1; i <= min(k2, h); i++) {
        sum += footMan(f, h - i);
        sum %= M;
    }
    return sum;
}
function min(x, y) {
  return (x < y) ? x : y;
}


var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (n === 0 || n === m) {
    print(0);
} else if (m === 0){
    print(1);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr.filter(x => x).length - arr[arr.length - 1] - m);
}

var firstLine = readline().split(' ');
var rdy = false
if(+firstLine[1] === 0) print(1);
if(+firstLine[1] !== 0) {
if(+firstLine[1] === +firstLine[0]){ rdy = true; print(0);}
if((+firstLine[0] - +firstLine[1] >= +firstLine[1]) && !rdy){rdy = true; print(+firstLine[1]);}
if((+firstLine[0] - +firstLine[1] < +firstLine[1]) && !rdy) print(+firstLine[0] - +firstLine[1]);
}

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

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);

  if (m === 0 || m === 1) {
    console.log(1);
  }
  else if (n === m) {
    console.log(0);
  }
  else if (n / 2 > m) {
    console.log(m);
  }
  else {
    console.log(n - m);
  }

  c++;
});

ip = readline().split(' ').map(Number);
n = ip[0], k = ip[1];
if (k === 0){
    print(1);
}else
if (k <= n/2){
    print(k)
} else {
    print(n-k);
}

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split(" ");
    console.log(findg(parseInt(arr[0]), parseInt(arr[1])));
  });

 function findg(n, m){
    if(n === m){
        return 0;
    } else if(m === 0){
        return 1;
    }
    m--;
    n--;
    let gcount  = 1;
    for(let i = 0; i < m; i++){
        if(n === 0 || n === 1){
            gcount--;
        } else if (n === 2) {
            n-=2;
        } else {
            gcount++;
            n-=2;
        }
    }
    return gcount;
 }

var firstLine = readline().split(' ');
if(+firstLine[1] === +firstLine[0]) print(0);
if(+firstLine[0] / +firstLine[1] === +firstLine[1]) print(+firstLine[1]);
if(+firstLine[0] / +firstLine[1] > +firstLine[1]) print(+firstLine[1]);
if(+firstLine[0] / +firstLine[1] < +firstLine[1]) print(+firstLine[0] - +firstLine[1]);

var firstLine = readline().split(' ');
if(+firstLine[1] === 0) print(1);
if(+firstLine[1] === +firstLine[0]) print(0);
if(+firstLine[0] / +firstLine[1] === +firstLine[1]) print(+firstLine[1]);
if(+firstLine[0] / +firstLine[1] > +firstLine[1]) print(+firstLine[1]);
if(+firstLine[0] / +firstLine[1] < +firstLine[1]) print(+firstLine[0] - +firstLine[1]);

var firstLine = readline().split(' ');
if(+firstLine[1] === 0) print(1);
if(+firstLine[1] !== 0) {
    if(+firstLine[1] === +firstLine[0]) print(0);
    if(+firstLine[0] / +firstLine[1] >= +firstLine[1]) print(+firstLine[1]);
    if(+firstLine[0] / +firstLine[1] < +firstLine[1]) print(+firstLine[0] - +firstLine[1]);
}

var firstLine = readline().split(' ');
var rdy = false
if(+firstLine[1] === 0) print(1);
if(+firstLine[1] !== 0) {
if(+firstLine[1] === +firstLine[0]){ rdy = true; print(0);}
if((+firstLine[0] / +firstLine[1] >= +firstLine[1]) && !rdy) print(+firstLine[1]);
if((+firstLine[0] / +firstLine[1] < +firstLine[1]) && !rdy) print(+firstLine[0] - +firstLine[1]);
}

var firstLine = readline().split(' ');
var rdy = false
if(+firstLine[1] === 0) print(1);
if(+firstLine[1] !== 0) {
if(+firstLine[1] === +firstLine[0]){ rdy = true; print(0);}
if((+firstLine[0] / +firstLine[1] >= +firstLine[1]) && !rdy){rdy = true; print(+firstLine[1]);}
if((+firstLine[0] / +firstLine[1] < +firstLine[1]) && !rdy) print(+firstLine[0] - +firstLine[1]);
}

ip = readline().split(' ').map(Number);
n = ip[0], k = ip[1];
if (k <= n/2){
    print(k)
} else {
    print(n-k);
}

ip = readline().split(' ').map(Number);
n = ip[0], k = ip[1];
if (k <= n/2 && k !== 0){
    print(k)
} else {
    print(n-k);
}

var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (n === 0 || n === m) {
    print(0);
} else if (m === 0){
    print(1);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr.filter(x => x).length - arr[arr.length - 1]);
}

var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (m === 0 || n === m) {
    print(0);
} else if (m === 0){
    print(1);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr.filter(x => x).length - arr[arr.length - 1]);
}

var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (m === 0 || n === m) {
    print(0);
} else if (m === 0){
    print(1);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr);
    print(arr.filter(x => x).length - arr[arr.length - 1]);
}

var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (m === 0 || n === m) {
    print(0);
} else if (m === 1){
    print(1);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr.filter(x => x).length - arr[arr.length - 1]);
}

var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (m === 0 || n === m) {
    print(0);
} else if (m === 0){
    print(1);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr.filter(x => x).length - arr[arr.length - 1] - m);
}

var n, m;
readline().split(' ').forEach(function(v, i){
    if (i === 0) {
        n = parseInt(v);
    } else {
        m = parseInt(v);
    }
});

if (m === 0 || m === 1 || n === m) {
    print(0);
} else {
    arr = [];

    for(var i = 0; i < n; i++) {
        if (!arr[i - 1] && m > 0) {
            arr[i] = 1;
            m--;
        } else {
            arr[i] = 0;
        }
    }

    print(arr.filter(x => x).length - arr[arr.length - 1]);
}

var firstLine = readline().split(' ');
if(+firstLine[1] === +firstLine[0]) print(0);
if(+firstLine[0] / +firstLine[1] === +firstLine[1]) print(+firstLine[1]);
if(+firstLine[0] / +firstLine[1] > +firstLine[1]) print(+firstLine[0] - +firstLine[1]);
if(+firstLine[0] / +firstLine[1] < +firstLine[1]) print(+firstLine[1]);

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split(" ");
    console.log(findg(parseInt(arr[0]), parseInt(arr[1])));
  });

 function findg(n, m){
    if(n === m){
        return 0;
    } else if(m === 0){
        return 1;
    }
    m--;
    let gcount  = 1;
    for(let i = 0; i < m-1; i++){
        if(n === 0 || n === 1){
            gcount--;
        } else {
            gcount++;
            n-=2;
        }
    }
    return gcount;
 }

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split(" ");
    console.log(findg(parseInt(arr[0]), parseInt(arr[1])));
  });

 function findg(n, m){
    if(n === m){
        return 0;
    } else if(m === 0){
        return 1;
    }
    m--;
    let gcount  = 0;
    for(let i = 0; i < m-1; i++){
        if(n === 0 || n === 1){
            gcount--;
        } else {
            gcount++;
            n-=2;
        }
    }
    return n;
 }

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split(" ");
    console.log(findg(parseInt(arr[0]), parseInt(arr[1])));
  });

 function findg(n, m){
    if(n === m){
        return 0;
    } else if(m === 0){
        return 1;
    }
    m--;
    let gcount  = 1;
    for(let i = 0; i < m-1; i++){
        if(n === 0 || n === 1){
            gcount--;
        } else {
            gcount++;
            n-=2;
        }
    }
    return n;
 }

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split(" ");
    console.log(findg(parseInt(arr[0]), parseInt(arr[1])));
  });

 function findg(n, m){
    if(n === m){
        return 0;
    } else if(m === 0){
        return 1;
    }
    m--;
    let gcount  = 1;
    for(let i = 0; i < m; i++){
        if(n === 0 || n === 1){
            gcount--;
        } else {
            gcount++;
            n-=2;
        }
    }
    return gcount;
 }


print(function(n,m){
	m%=(n*n+n)/2
	for(var i=1; m>=i; m-=i++);
	return m;
}.apply(0, readline().split(' ').map(Number)))

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

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);
  let ans = m;
  let iter = 1;

  while (ans >= iter) {
    ans -= iter;
    iter++;

    if (iter > n) {
      iter = 1;
    }
  }

  console.log(ans);

  c++;
});

var line = readline().split(" ");
var a = parseInt(line[0]);
var b = parseInt(line[1]);

// var a = 4
// var b = 11

var j = 0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
var i = 1;

while (b>=i) {
	b-=i;
	i++;
}
print(b)

var nm = readline();
nm = nm.split(" ");
nm[0] = parseInt(nm[0]);
nm[1] = parseInt(nm[1]);
var i = 1;
while(8)
{
    if(nm[1] - i < 0){print(nm[1]); break;}
    nm[1] -= i;
    i++;
    if(i > nm[0]){i = 1;}
}

;(function () {
	var n = readline().split(' ').map(Number),
		i = 1;

	while (n[1] >= i) {
		n[1] -= i;
		if (i == n[0]) i = 0;
		else i = i + 1;
	}

	print(n[1]);

}).call(this)

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

rl.on('line', (d) => {
  const [n, m] = d.split(' ').map(Number);
  let ans = m;
  let iter = 1;

  while (ans > iter) {
    ans -= iter;
    iter++;

    if (iter > n) {
      iter = 1;
    }

    if (iter === 1 && ans === 1) {
      ans = 0;
    }
  }

  console.log(ans);

  c++;
});

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);
// var a = 4
// var b = 11

var j = 0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
var i = 1;

while (b>=i) {
	b-=i;
	i++;
}
print(b)

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);

var j=0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
i=1;

while (b>=i) {
	b-=i;
	i++;
}
print(b+"\n");

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);
var a = 4
var b = 11

var j=0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
i=1;

while (b>=i) {
	b-=i;
	i++;
}
print(line)

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);
var a = 4
var b = 11

var j = 0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
var i = 1;

while (b>=i) {
	b-=i;
	i++;
}
print(b)

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);

var j=0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
i=1;

while (b>=i) {
	b-=i;
	i++;
}
print(b);

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);

// var a = 4
// var b = 11

var j = 0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
var i = 1;

while (b>=i) {
	b-=i;
	i++;
}
print(line[0], line[1])

var line = readline().split();
var a = parseInt(line[0]);
var b = parseInt(line[1]);
// var a = 4
// var b = 11

var j=0;
for (var i = 1; i <= a; i++) {
	j += i;
}

b = b % j;
i=1;

while (b>=i) {
	b-=i;
	i++;
}
print(b.toString()+"\n");

var line = readline().split()
var a = parseInt(line[0])
var b = parseInt(line[1])

var j=0
for (var i = 1; i <= a; i++) {
	j += i
}

b = b % j
i=1

while (b>=i) {
	b-=i
	i++
}
print(b)


var nums = readline().split(' ');
var a = new Array();
for(var i=0;i<3;i++)
{
    a[i] = parseInt(nums[i]);
}

a.sort(sortNum);
var b = false;
if(a[0]>2*(a[1]+a[2]))
{
    print(a[1]+a[2]);
}
else
{
    var x = a[0]+a[1]+a[2];
	print((x-x%3)/3);
}

function sortNum(a, b)
{
    return b - a;
}

var a = readline().split(" ");
for(var i=0; i<a.length; i++) { a[i] =(parseInt(a[i], 10));}

function compareNumbers(a, b)
{
    return a-b;
}
a.sort(compareNumbers);
if(a[2]>(a[0]+a[1])*2)a[2]=2*(a[0]+a[1]);
print(Math.floor((a[2]+a[1]+a[0])/3));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
inp = inp.sort(function(a,b){return a > b;})
print(Math.min((Math.floor((inp[0]+inp[1]+inp[2])/3)), inp[0]+inp[1]));

const readline = require('readline');

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

rl.on('line', input => {
  console.log(min(input.split(' ')));
  process.exit();
});

const min = input => {
  const r = parseInt(input[0]);
  const g = parseInt(input[1]);
  const b = parseInt(input[2]);

  return Math.floor(Math.min((r+g+b)/3, (r+b+g)-Math.max(r,g,b)));
}

var main = function(r, b, g) {
    print(Math.min((r+g), (b+g), (r+b), Math.floor((r+b+g)/3)));
}

main.apply(0, readline().split(' ').map(Number));

const readline = require('readline');

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

rl.on('line', input => {
  console.log(min(input.split(' ')));
  process.exit();
});

const min = input => {
  return parseInt(input.reduce((ant, act) => parseInt(ant) + parseInt(act)) / input.length);
}

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var r = inp[0];
var g = inp[1];
var b = inp[2];

print(Math.floor((r+g+b) % 3));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var r = inp[0];
var g = inp[1];
var b = inp[2];

print(Math.max(Math.min(r + g, b),Math.min(r +b, g),Math.min(b +g ,r)));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
var r = inp[0];
var g = inp[1];
var b = inp[2];

print((r+g+b) % 3);

var inp = readline().split(" ").map(function(x){return parseInt(x);});
inp = inp.sort(function(a,b){return a > b;})

print(Math.max((Math.floor((inp[0]+inp[1]+inp[2])/3)), inp[0]+inp[1]));

var inp = readline().split(" ").map(function(x){return parseInt(x);});
inp = inp.sort(function(a,b){return a > b;})
var res = inp[0];
if (inp[1] - inp[0] != 0){
	res+=Math.min(inp[1]-inp[0], Math.floor((inp[2] - inp[0])/2));
}

print(res);

var main = function(r, b, g) {
    print(Math.min((r+g), (b+g), (r+g), Math.floor((r+b+g)/3)));
}

main.apply(0, readline().split(' ').map(Number));


function checkPairs (pairs) {
  pairs = pairs.split(" ").join("");
  pairs = pairs.replace(/0+$/g, ""); // strip trailing zeros
  pairs = pairs.replace(/^0+/g, ""); // strip first zeros
  pairs = pairs.replace(/0{2,}/g, ""); //strip 00

  return pairs.length;
}

var smth = readline(),
    input = readline();

var output = checkPairs.call(null, input);

write(output);

n = +readline();
a = readline().split(" ").map(Number);

answer = 0;
last_i = -100;
for (var i = 0; i < n; i++) {
	if (a[i] == 1) {
		if (last_i >=0 && last_i+2 == i) {
			// a[i-1] == 0
			answer += 1;
		}
		answer += 1;
		last_i = i;
	}
}
write(answer);

function checkPairs (pairs) {
  pairs = pairs.split(" ").join("");
  pairs = pairs.replace(/0+$/g, ""); // strip trailing zeros
  pairs = pairs.replace(/^0+/g, ""); // strip first zeros
  pairs = pairs.replace(/00/g, ""); //strip 00

  return pairs.length;
}

var input = readline();

var output = checkPairs.call(null, input);

write(output);

function checkPairs (pairs) {
  pairs = pairs.split(" ").join("");
  pairs = pairs.replace(/0+$/g, ""); // strip trailing zeros
  pairs = pairs.replace(/^0+/g, ""); // strip first zeros
  pairs = pairs.replace(/00/g, ""); //strip 00

  return pairs.length;
}

var smth = readline(),
    input = readline();

var output = checkPairs.call(null, input);

write(output);


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]);
	};
	return tokens;
}

function main() {
	var input = tokenizeIntegers(readline());

	function isRightTriangle(input) {
		var squares = [];
		for (var i = 0; i < 3; i += 1) {
			squares.push(Math.pow(input[(2*i+2)%6]-input[2*i], 2) +
					   Math.pow(input[(2*i+3)%6]-input[2*i+1], 2));
		}
		squares.sort(function(a, b) {
			return a-b;
		});
		if (squares[0] == 0) {
			return false;
		}
		return (squares[2] == squares[1] + squares[0]);
	}

	if (isRightTriangle(input)) {
		print("RIGHT");
		return;
	}

	var dx = [0, 1, 0, -1], dy = [-1, 0, 1, 0];
	for (var i = 0; i < 3; i += 1) {
		for (var j = 0; j < 4; j += 1) {
			input[2*i] += dx[j];
			input[2*i+1] += dy[j];
			if (isRightTriangle(input)) {
				print("ALMOST");
				return;
			}
			input[2*i] -= dx[j];
			input[2*i+1] -= dy[j];
		}
	}

	print("NEITHER");
}

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]);
	};
	return tokens;
}

function main() {
	var input = tokenizeIntegers(readline());

	function isRightTriangle(input) {
		var squares = [];
		for (var i = 0; i < 3; i += 1) {
			squares.push(Math.pow(input[(2*i+2)%6]-input[2*i], 2) +
					   Math.pow(input[(2*i+3)%6]-input[2*i+1], 2));
		}
		squares.sort(function(a, b) {
			return a-b;
		});
		return (squares[2] == squares[1] + squares[0]);
	}

	if (isRightTriangle(input)) {
		print("RIGHT");
		return;
	}

	var dx = [0, 1, 0, -1], dy = [-1, 0, 1, 0];
	for (var i = 0; i < 3; i += 1) {
		input[2*i] += dx[i];
		input[2*i+1] += dy[i];
		if (isRightTriangle(input)) {
			print("ALMOST");
			return;
		}
		input[2*i] -= dx[i];
		input[2*i+1] -= dy[i];
	}

	print("NEITHER");
}

main();


var n=+readline();
var f=false;
var low=0;
var high=0;
while(n--){
	(function(x, y){
		if(x%2!==y%2) f=true;
		low+=x;
		high+=y;
	}).apply(0, readline().split(' ').map(Number));
}
if(low%2===high%2){
	if(low%2===0){
		print(0);
	}else if(f){
		print(1);
	}else{
		print(-1);
	}
}else{
	print(-1);
}

function rda(){ return readline().split(" ").map(Number); }
function rdn(){ return Number(readline()); }

var n = rdn();
var l = 0, r = 0, dif = false;
for(var i = 0; i < n; i++){
    var inp = rda();
    l += inp[0];
    r += inp[1];
    if( (inp[0]%2 == 1 && inp[1]%2 == 0) || (inp[1]%2 == 1 && inp[0]%2 == 0) ){
        dif = true;
    }
}

var ans;
if(l%2 == 0 && r%2 == 0){
    ans = 0;
}else if(l%2 == 1 && r%2 == 1 && dif){
    ans = 1;
}else{
    ans = -1;
}

write(ans);

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]);
	};
	return tokens;
}

function main() {
	var numDominoes = parseInt(readline(), 10);
	var sums = [0, 0],
		parity = [0, 1, 0, 1, 0, 1, 0],
		foundImbalancedDomino = false;

	for (var dominoIndex = 0; dominoIndex < numDominoes; ++dominoIndex) {
		var domino = tokenizeIntegers(readline());
		sums[0] += domino[0];
		sums[1] += domino[1];
		if (!foundImbalancedDomino && parity[domino[0]] != parity[domino[1]]) {
			foundImbalancedDomino = true;
		}
	}

	var left = sums[0] % 2, right = sums[1] % 2;

	if (left == 0 && right == 0) {
		print(0);
	}
	else if (left == 1 && right == 1) {
		print(foundImbalancedDomino ? 1 : -1);
	}
	else {
		print(-1);
	}
}

main();

(function (){
    var i, j, n = parseInt(readline());
    var a = [], sumup = 0, sumlow = 0;
    for(i = 0 ; i < n ; ++i){
        a[i] = readline().split(' ');
        a[i][0] = parseInt(a[i][0]);
        a[i][1] = parseInt(a[i][1]);
        sumup += a[i][0];
        sumlow += a[i][1];
    }
    var time = 0;
    if ( sumup % 2 + sumlow % 2 == 2 ){
        for(i = 0 ; i < n ; ++i){
            if ( a[i][0] % 2 + a[i][1] % 2 == 1 ){
                time = 1;
                break;
            }
        }
        if ( time == 0 ) --time;
    }else if ( sumup % 2 + sumlow % 2 == 1 ){
        time = -1;
    }
    print(time);

})();

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

function solve(){
    const n = +(readLine());
    let a = [], b = [];
    let suma = 0, sumb = 0;
    for(let i = 0; i < n; i++){
        let line = readLine();
        a.push(+(line[0]));
        b.push(+(line[2]));
        suma += a[i];
        sumb += b[i];
    }
    let check = (s,t) => s%2 == 0 && t%2 == 0;
    let bool = false;
    if(check(suma, sumb)){
        console.log(0);
        return;
    }
    for(let i = 0; i < n; i++){
        let at = suma, bt = sumb;
        at -= a[i];
        bt -= b[i];
        at += b[i];
        bt += a[i];
        if(check(at, bt)){
            console.log(1);
            return;
        }
    }
    console.log(-1);
}

;(function () {
	var n = +readline();
	var d = [];

	var s = 0;
	for (var i = 0; i < n; i++) d.push( readline().split(' ').map(function (e) { e = +e; s += e; return e; }) );

	if (s % 2) {
		print(-1);
		return;
	}

	s = d.reduce(function (p, e) { return p + e[0]; }, 0);
	print( s%2 ? 1 : ( n != 1 ? 0 : -1 ) );

}).call(this);

;(function () {
	var n = +readline();
	var d = [];

	var s = 0;
	for (var i = 0; i < n; i++) d.push( readline().split(' ').map(function (e) { e = +e; s += e; return e; }) );

	if (s % 2) {
		print(-1);
		return;
	}

	s = d.reduce(function (p, e) { return p + e[0]; }, 0);
	print( s%2 ? 1 : 0 );

}).call(this);

;(function () {
	var n = +readline();
	var d = [];

	var s = 0;
	for (var i = 0; i < n; i++) d.push( readline().split(' ').map(function (e) { e = +e; s += e; return e; }) );

	if (s % 2 || n == 1) {
		print(-1);
		return;
	}

	s = d.reduce(function (p, e) { return p + e[0]; }, 0);
	print( s%2 ? 1 : 0 );

}).call(this);

;(function () {
	var n = +readline();
	var d = [];

	for (var i = 0; i < n; i++) d.push( readline().split(' ').map( Number ) );

	var s = 0;
	s = d.reduce( function (p, e) { return p + e[0] + e[1]; }, 0 );

	if (s % 2) {
		print(-1);
		return;
	}

	var t = 0;
	t = d.reduce(function (p, e) { return p + ( e[0] % 2 && e[1] % 2 ); }, 0);

	if (!(t % 2) && t != 0) {
		print(-1);
		return;
	}

	print( d.reduce( function (p, e) { return p + e[0]; }, 0 ) % 2 ? 1 : 0 );

}).call(this);

(function (){
    var i, j, n = parseInt(readline());
    var a = [], sumup = 0, sumlow = 0;
    for(i = 0 ; i < n ; ++i){
        a[i] = readline().split(' ');
        sumup += a[i][0];
        sumlow += a[i][1];
    }
    var time = 0;
    if ( sumup % 2 + sumlow % 2 == 2 ){
        for(i = 0 ; i < n ; ++i){
            if ( a[i][0] % 2 + a[i][1] % 2 == 1 ){
                time = 1;
                break;
            }
        }
    }else if ( sumup % 2 + sumlow % 2 == 1 ){
        time = -1;
    }
    print(time);

})();

(function (){
    var i, j, n = parseInt(readline());
    var a = [], sumup = 0, sumlow = 0;
    for(i = 0 ; i < n ; ++i){
        a[i] = readline().split(' ');
        sumup += a[i][0];
        sumlow += a[i][1];
    }
    var time = 0;
    if ( sumup % 2 + sumlow % 2 == 2 ){
        for(i = 0 ; i < n ; ++i){
            if ( a[i][0] % 2 + a[i] % 2 == 1 ){
                time = 1;
                break;
            }
        }
    }else if ( sumup % 2 + sumlow % 2 == 1 ){
        time = -1;
    }
    print(time);

})();

(function (){
    var i, j, n = parseInt(readline());
    var a = [], sumup = 0, sumlow = 0;
    for(i = 0 ; i < n ; ++i){
        a[i] = readline().split(' ');
        a[i][0] = parseInt(a[i][0]);
        a[i][1] = parseInt(a[i][1]);
        sumup += a[i][0];
        sumlow += a[i][1];
    }
    var time = 0;
    if ( sumup % 2 + sumlow % 2 == 2 ){
        for(i = 0 ; i < n ; ++i){
            if ( a[i][0] % 2 + a[i][1] % 2 == 1 ){
                time = 1;
                break;
            }
        }
    }else if ( sumup % 2 + sumlow % 2 == 1 ){
        time = -1;
    }
    print(time);

})();


function Stack(){this.a=[]}function Queue(){this.l=new Stack,this.r=new Stack}function Reader(){this.b=[],this.c=0}function Writer(){this.l=[""],this.c=0}Array.prototype.back=function(){return this[this.length-1]},Math.gcd=function(t,i){return i?gcd(i,t%i):t},Math.lcm=function(t,i){return t/gcd(t,i)*i},Math.sign=function(t){return(t>0)-(0>t)},Math.cmp=function(t,i){return(+t>+i)-(+i>+t)},Math.icmp=function(t,i){return(+i>+t)-(+t>+i)},Stack.prototype.empty=function(){return 0==this.a.length},Stack.prototype.push=function(t){this.a.push(t)},Stack.prototype.pop=function(){return this.empty()?void 0:this.a.pop()},Stack.prototype.top=function(){return this.empty()?void 0:this.a[this.a.length-1]},Stack.prototype.clear=function(){this.a=[]},Stack.prototype.size=function(){return this.a.length},Queue.prototype.push=function(t){this.l.push(t)},Queue.prototype.empty=function(){return this.r.empty()&&this.l.empty()},Queue.prototype.pop=function(){if(this.r.empty())for(;!this.l.empty();)this.r.push(this.l.pop());return this.r.empty()?void 0:this.r.pop()},Queue.prototype.front=function(){if(this.r.empty())for(;!this.l.empty();)this.r.push(this.l.pop());return this.r.empty()?void 0:this.r.top()},Queue.prototype.size=function(){return l.size()+r.size()},Queue.prototype.clear=function(){l.clear(),r.clear()},Reader.prototype.next=function(){return this.c==this.b.length&&(this.c=0,this.b=readline().split(" ")),this.b[this.c++]},Writer.prototype.print=function(t){this.l[this.c]+=t},Writer.prototype.println=function(t){this.l[this.c]+=t,this.l.push(""),++this.c},Writer.prototype.flush=function(){print(this.l.join("\n")),this.l=[]};

function main(cin, cout)
{
    var n = +cin.next();
    var k1 = +cin.next();
    var q1 = new Queue();
    var q2 = new Queue();
    var t;
    for(var i = 0; i < k1; ++i)
    {
        t = +cin.next();
        q1.push(t);
    }
    var k2 = +cin.next();
    for(var i = 0; i < k2; ++i)
    {
        t = +cin.next();
        q2.push(t);
    }
    var iter = 0;
    var c1, c2;

    while(!q1.empty() && !q2.empty())
    {
        c1 = q1.front();
        q1.pop();
        c2 = q2.front();
        q2.pop();
        if (c1 > c2)
        {
            q1.push(c2);
            q1.push(c1);
        } else
        {
            q2.push(c1);
            q2.push(c2);
        }
        iter++;
        if (iter == 10000000)
            break;
    }
    if (iter == 10000000)
        cout.print("-1");
    else
        cout.print(iter + " " + (q1.empty() ? 2 : 1));
}

var cin = new Reader();
var cout = new Writer();

main(cin, cout);

cout.flush();

function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = false;

    this.rec = function( arr , brr , firstFlag , cn ) {
    	var res , r1 , newArr , newBrr , fl , sz , i , sz1 , sz2 ;
    	if( cn > 1000 ) {
    		return -1 ;
    	}
    	if( firstFlag == false && arr.length == this.baseCaseArr.length && brr.length == this.baseCaseBrr.length ) {
    		fl = 1 ;
    		sz = arr.length ;
    		for( i = 0 ; i < sz ; i++ ) {
    			if( arr[ i ] != this.baseCaseArr[ i ] ) {
    				fl = 0 ;
    				break ;
    			}
    		}
    		sz = brr.length ;
    		for( i = 0 ; i < sz ; i++ ) {
    			if( brr[ i ] != this.baseCaseBrr[ i ] ) {
    				fl = 0 ;
    				break ;
    			}
    		}
    		if( fl == 1 ) {
    			return -1 ;
    		}
    	}
    	if( arr.length == 0 ) {
    		this.winner = 2 ;
    		return 0 ;
    	}
    	if( brr.length == 0 ) {
    		this.winner = 1 ;
    		return 0 ;
    	}
    	newArr = [] ;
    	newBrr = [] ;
    	sz1 = arr.length ;
    	sz2 = brr.length ;
    	for( i = 1 ; i < sz1 ; i++ ) {
			newArr.push( arr[ i ] ) ;
		}
		for( i = 1 ; i < sz2 ; i++ ) {
			newBrr.push( brr[ i ] ) ;
		}
    	if( arr[ 0 ] > brr[ 0 ] ) {
    		newArr.push( brr[ 0 ] ) ;
    		newArr.push( arr[ 0 ] ) ;
    	}
    	else {
    		newBrr.push( arr[ 0 ] ) ;
    		newBrr.push( brr[ 0 ] ) ;
    	}
    	r1 = this.rec( newArr , newBrr , false , cn + 1 ) ;
    	if( r1 == -1 ) {
    		res = -1 ;
    	}
    	else {
    		res = r1 + 1 ;
    	}
    	return res ;
    } ;

    this.solveCase = function() {
        var res , i , j , fl , cn , temp ;
        res = 0 ;
        this.baseCaseArr = [] ;
        for( i = 0 ; i < this.k1 ; i++ ) {
        	this.baseCaseArr.push( this.arr[ i ] ) ;
        }
        this.baseCaseBrr = [] ;
        for( i = 0 ; i < this.k2 ; i++ ) {
        	this.baseCaseBrr.push( this.brr[ i ] ) ;
        }
        this.winner = -1 ;
        res = this.rec( this.arr , this.brr , true , 0 ) ;
        if( res == -1 ) {
        	print( res );
        }
        else {
        	print( res + ' ' + this.winner );
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.k1 = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.k1 ; i++ ) {
                this.arr.push( irObj.nextInt() ) ;
            }
            this.brr = [] ;
            this.k2 = irObj.nextInt();
            for( i = 0 ; i < this.k2 ; i++ ) {
                this.brr.push( irObj.nextInt() ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();


readline();
var walk = readline();
var pointer = 0;
var counter = 0;
while (pointer < (walk.length - 1)) {
  if (walk[pointer] != walk[pointer + 1]) {
    counter++;
    pointer += 2;
  } else {
    pointer++;
  }
}
print(walk.length - counter);

function main() {
  var n = readline();
  var line = readline();

  line = line.replace(/(UR|RU)/g, 'D');

  print(line.length);
}

main();

n = readline();
str = readline().split('');

var count = 0;

for (var i = 0; i < n; i++) {
	if ((str[i] == 'R' && str[i + 1] == 'U') || (str[i] == 'U' && str[i + 1] == 'R')) {
		count++;
		i++;
	} else {
		count++;
	};
};

print(count);

//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 s = next();
	var output = 0;
	for(var i = 0; i < N; i++){
		if(s[i] == "U" && s[i + 1] == "R" || s[i] == "R" && s[i + 1] == "U"){
			output++;
			i++;
		}else{
			output++;
		}
	}
	myout(output);
}

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

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

  let ans = 0;

  for (let i = 0; i < str.length; i++) {
    if (str[i] === 'R' && str[i + 1] === 'U' || str[i] === 'U' && str[i + 1] === 'R') {
      ans++;
      i++;
    }
    else {
      ans++;
    }
  }

  console.log(ans);

  c++;
});

let data = '';
process.stdin.on('data', c => data += c);
const solution = () => {
	let line = data.split('\n');
	let n = parseInt(line[0], 10);
	let a = line[1].replace(/RU|UR/g,"D").trim();
	console.log(a.length);

};

process.stdin.on('end', solution);

let data = '';
process.stdin.on('data', c => data += c);
const solution = () => {
	let line = data.split('\n');
	let n = parseInt(line[0], 10);
	let a = line[1].replace("RU","D").replace("UR","D");
	console.log(a.length);

};

process.stdin.on('end', solution);

let data = '';
process.stdin.on('data', c => data += c);
const solution = () => {
	let line = data.split('\n');
	let n = parseInt(line[0], 10);
	let a = line[1].replace(/RU|UR/g,"D");
	console.log(a.length);

};

process.stdin.on('end', solution);

function main() {
  var n = readline();
  var line = readline();

  line = line.replace(/UR/g, 'D');
  line = line.replace(/RU/g, 'D');

  print(line.length);
}

main();


var input = readline();
var check = [];
for (var i = 0;i<1000;i++){
    if (i%8 == 0){
      check.push(i.toString());
    }
}
var finded = false;
for (var k = 0 ;k<check.length;k++){
  var current = check[k];
  var result = '';
  var j = 0;
  for(var i = 0;i<input.length;i++){
    if(input[i] == current[j]){
      result+=current[j];
      j++;
      if (j==current.length && !finded){
        finded = true;
        print('YES');
        print(result);
        break;
      }
    }
  }
}
if(!finded){
  var nullsCount = 0;
  for (var i = 0 ;i<input.length;i++){
    if(input[i]==0)
      nullsCount++;
  }
  if(nullsCount>=3){
    print('YES');
    print(input[0]+'000');
  }
  else
    print('NO');
}

function rda(){ return readline().split(" ").map(Number); }
function rdn(){ return +readline(); }

var n = readline().split("").map(Number);

var ans = "NO";

for(var i = 0; i < n.length; i++){
    if(ans != "NO") break;
    var x = n[i];
    if(x % 8 == 0){
        ans = "YES\n" + x;
        break;
    }
}

for(var i = 0; i < n.length; i++){
    if(ans != "NO") break;
    for(var j = i+1; j < n.length; j++){
        if(ans != "NO") break;
        var x = n[i]*10 + n[j];
        if(x % 8 == 0){
            ans = "YES\n" + x;
            break;
        }
    }
}

for(var i = 0; i < n.length; i++){
    if(ans != "NO") break;
    for(var j = i+1; j < n.length; j++){
        if(ans != "NO") break;
        for(var k = j+1; k < n.length; k++){
            if(ans != "NO") break;
            var x = n[i]*100 + n[j]*10 + n[k];
            if(x % 8 == 0){
                ans = "YES\n" + x;
                break;
            }
        }
    }
}

write(ans);

function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = false;

	this.dp = function( i , rem , fl ) {
		var ret , res , r1 , re , a ;
		if( i >= this.n ) {
			if( rem == 0 && fl == 1 ) {
				return 1 ;
			}
			return 0 ;
		}
		re = this.done[ i ][ rem ][ fl ] ;
		ret = this.memo[ i ][ rem ][ fl ] ;
		if( re == this.cc ) {
			return ret ;
		}
		this.done[ i ][ rem ][ fl ] = this.cc ;
		res = 0 ;
		r1 = this.dp( i + 1 , rem , fl ) ;
		res |= r1 ;
		a = this.s.charCodeAt( i ) - '0'.charCodeAt( 0 ) ;
		r1 = this.dp( i + 1 , ( rem * 10 + a ) % 8 , 1 ) ;
		res |= r1 ;
		this.memo[ i ][ rem ][ fl ] = res ;
		return res ;
	} ;

	this.dpPrint = function( i , rem , fl ) {
		var r1 , a ;
		if( i >= this.n ) {
			return '' ;
		}
		r1 = this.dp( i + 1 , rem , fl ) ;
		if( r1 == 1 ) {
			return this.dpPrint( i + 1 , rem , fl ) ;
		}
		a = this.s.charCodeAt( i ) - '0'.charCodeAt( 0 ) ;
		r1 = this.dp( i + 1 , ( rem * 10 + a ) % 8 , 1 ) ;
		if( r1 == 1 ) {
			return this.s.charAt( i ) + this.dpPrint( i + 1 , ( rem * 10 + a ) % 8 , 1 ) ;
		}
	} ;

    this.solveCase = function() {
        var res , i , j , fl , cn , temp , len , numberString , resNumber ;
        res = 0 ;
        this.n = this.s.length ;
        res = this.dp( 0 , 0 , 0 ) ;
        if( res == 0 ) {
        	print( 'NO' );
        }
        else {
        	print( 'YES' );
        	numberString = this.dpPrint( 0 , 0 , 0 ) ;
        	len = numberString.length ;
        	resNumber = '' ;
        	fl = 0 ;
        	for( i = 0 ; i < len ; i++ ) {
        		if( numberString.charCodeAt( i ) > '0'.charCodeAt( 0 ) ) {
        			fl = 1 ;
        		}
        		if( fl == 1 ) {
        			resNumber += numberString.charAt( i ) ;
        		}
        	}
        	if( resNumber == '' ) {
        		resNumber = '0' ;
        	}
        	print( resNumber );
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.s = irObj.nextString();
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.adjList = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.adjList.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adjList = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adjList.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( new Array() );
                this.done[ i ].push( new Array() );
                for( k = 0 ; k < 2 ; k++ ) {
                	this.memo[ i ][ j ].push( -1 );
                	this.done[ i ][ j ].push( 0 );
                }
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();

const memo = {};

function isDivisibleBy8(n) {
  if (n.length >= 3) {
    var lastThree = parseInt(n.slice(n.length - 3), 10);
    if (lastThree % 8 === 0) {
      return true;
    }
    return false;
  }
  var remainder = parseInt(n, 10) % 8;
  return remainder === 0;
}

function resolve(n) {
  if (n.length === 0) {
    return null;
  }
  if (memo[n] === null) {
    return null;
  }
  if (isDivisibleBy8(n)) {
    return n;
  }
  if (n.length >= 3) {
    var arr = n.split('');
    for (var i = 1; i < 4; i++) {
      var sub = arr
        .slice(0, n.length - i)
        .concat(arr.slice(n.length - i + 1))
        .join('');
      var res = resolve(sub);
      if (res !== null) {
        return res;
      }
    }
  }
  if (n.length === 2) {
    if (n[0] === '0' || n[1] === '0') {
      return '0';
    }
    if (n[0] === '8' || n[1] === '8') {
      return '8';
    }
  }
  memo[n] = null;
  return null;
}

//test
const k = readline();

const result = resolve(k);

print(result === null ? 'NO' : 'YES\n' + result);

const memo = {};

function isDivisibleBy8(n) {
  if (n.length >= 3) {
    var lastThree = parseInt(n.slice(n.length - 3), 10);
    if (lastThree % 8 === 0) {
      return true;
    }
    return false;
  }
  var remainder = parseInt(n, 10) % 8;
  return remainder === 0;
}

function resolve(n) {
  if (n.length === 0) {
    return null;
  }
  if (memo[n] === null) {
    return null;
  }
  if (isDivisibleBy8(n)) {
    return n;
  }
  if (n.length >= 3) {
    var arr = n.split('');
    for (var i = 1; i < 4; i++) {
      var sub = arr
        .slice(0, n.length - i)
        .concat(arr.slice(n.length - i + 1))
        .join('');
      var res = resolve(sub);
      if (res !== null) {
        return res;
      }
    }
  }
  if (n.length === 2) {
    if (n[0] === '8' || n[1] === '8') {
      return '8';
    }
    if (n[0] === '0' || n[1] === '0') {
      return '0';
    }
  }
  memo[n] = null;
  return null;
}

const k = readline();

const result = resolve(k);

print(result === null ? 'NO' : 'YES\n' + result);

const memo = {};

function isDivisibleBy8(n) {
  if (n.length >= 3) {
    var lastThree = parseInt(n.slice(n.length - 3), 10);
    if (lastThree % 8 === 0) {
      return true;
    }
    return false;
  }
  var remainder = parseInt(n, 10) % 8;
  return remainder === 0;
}

function resolve(n) {
  if (n.length === 0) {
    return null;
  }
  if (memo[n] === null) {
    return null;
  }
  if (isDivisibleBy8(n)) {
    return n;
  }
  if (n.length >= 3) {
    var arr = n.split('');
    for (var i = 1; i < 4; i++) {
      var sub = arr
        .slice(0, n.length - i)
        .concat(arr.slice(n.length - i + 1))
        .join('');
      var res = resolve(sub);
      if (res !== null) {
        return res;
      }
    }
  }
  if (n.length === 2) {
    if (n[0] === '0' || n[1] === '0') {
      return '0';
    }
    if (n[0] === '8' || n[1] === '8') {
      return '8';
    }
  }
  memo[n] = null;
  return null;
}

const k = readline();

const result = resolve(k);

print(result === null ? 'NO' : 'YES\n' + result);

const memo = {};

function isDivisibleBy8(n) {
  if (n.length >= 3) {
    var lastThree = parseInt(n.slice(n.length - 3), 10);
    if (lastThree % 8 === 0) {
      return true;
    }
    return false;
  }
  var remainder = n % 8;
  return remainder === 0;
}

function resolve(n) {
  if (memo[n] === null) {
    return null;
  }
  if (isDivisibleBy8(n)) {
    return n;
  } else {
    var arr = n.split('');
    for (var i = 0; i < arr.length; i++) {
      var sub = arr
        .slice(0, i)
        .concat(arr.slice(i + 1))
        .join('');
      var res = resolve(sub);
      if (res !== null) {
        return res;
      }
    }
    memo[n] = null;
    return null;
  }
}

const k = readline();

const result = resolve(k);

print(result === null ? 'NO' : 'YES\n' + result);

const memo = {};

function resolve(n) {
  if (memo[n] === null) {
    return null;
  }
  if (parseInt(n, 10) % 8 === 0) {
    return n;
  } else {
    var arr = n.split('');
    for (var i = 0; i < arr.length; i++) {
      var sub = arr
        .slice(0, i)
        .concat(arr.slice(i + 1))
        .join('');
      var res = resolve(sub);
      if (res !== null) {
        return res;
      }
    }
    memo[n] = null;
    return null;
  }
}

const k = readline();

const result = resolve(k);

print(result === null ? 'NO' : 'YES\n' + result);


        var app = {
            'main' : function main()    {
                var result = 'NO',
                    targetX, targetY, stepCount,
                    minStepCount;

                targetX = readline().split(/\s/gi).map(Number);
                targetY = Math.abs(targetX[1]);
                stepCount = targetX[2];
                targetX = Math.abs(targetX[0]);

                minStepCount = targetX + targetY;

                if(stepCount >= minStepCount)   {
                    if((stepCount - minStepCount) % 2 == 0) result = 'YES';
                    else    result = 'NO';
                }

                print(result);
            }
        };

app.main();

///////////////////////////////////////////////////////////////////////////////
function readNumber () { return Number(readline()); }
function readNumbersArray () { return readline().split(' ').map(Number); }
function algebraicSum (startValue, finishValue, size) { return (startValue + finishValue) * size / 2; }
///////////////////////////////////////////////////////////////////////////////

print((function () {

	var array = readNumbersArray();
	var a = Math.abs(array[0]), b = Math.abs(array[1]), s = array[2];

	if (a + b > s) return 'No';
	if (a + b === s) return 'Yes';
	return ((s - a - b) % 2 === 0) ? 'Yes' : 'No';
})());

var tok = null;
var index = 0;
function next() {
    while (tok == null || index == tok.length) {
        tok = readline().split(' ');
        index = 0;
    }
    var res = tok[index++];
    return res;
}

function nextInt() {
    return parseInt(next());
}

function sortNumber(a, b) {
    return a - b;
}

function main() {
        var a=nextInt();
var b=nextInt();
var s=nextInt();
var c=Math.abs(a)+Math.abs(b);
if(s>=c&&(s-c)%2==0){
print("Yes");
}else{
print("No");
}
}

main();

var data = readline().split(' ');
var dist1 = parseInt(data[0]);
var dist2 = parseInt(data[1]);
var dist3 = parseInt(data[2]);
calculate(dist1, dist2, dist3);

function calculate(a, b, s)
{
    var distance = Math.abs(a) + Math.abs(b);
    var extra = s - distance;
    if(extra < 0)
    {
        write('No');
        return;
    }
    if(extra % 2 !== 0)
    {
        write('No');
        return;
    }
    write('Yes');
}

var input = readline().split(" "), a = +input[0], b = +input[1], s = +input[2];

if( s < (Math.abs(a) + Math.abs(b)) ){
	write("No");
}
else if( s == (Math.abs(a) + Math.abs(b)) ){
	write("Yes");
}
else{
	s -= (Math.abs(a) + Math.abs(b));
	if(s % 2 == 0){
		write("Yes");
	}
	else{
		write("No");
	}
}

var input = readline().split(" "), a = +input[0], b = +input[1], s = +input[2];

if(s < a+b){
	write("No");
}
else if(s == a+b){
	write("Yes");
}
else{
	s -= a+b
	if(s % 2 == 0){
		write("Yes");
	}
	else{
		write("No");
	}
}

///////////////////////////////////////////////////////////////////////////////
function readNumber () { return Number(readline()); }
function readNumbersArray () { return readline().split(' ').map(Number); }
function algebraicSum (startValue, finishValue, size) { return (startValue + finishValue) * size / 2; }
///////////////////////////////////////////////////////////////////////////////

print((function () {

	var array = readNumbersArray();
	var a = array[0], b = array[1], s = array[2];

	if (a + b > s) return 'No';
	if (a + b === s) return 'Yes';
	return ((s - a - b) % 2 === 0) ? 'Yes' : 'No';
})());

///////////////////////////////////////////////////////////////////////////////
function readNumber () { return Number(readline()); }
function readNumbersArray () { return readline().split(' ').map(Number); }
function algebraicSum (startValue, finishValue, size) { return (startValue + finishValue) * size / 2; }
///////////////////////////////////////////////////////////////////////////////

print((function () {

	var array = readNumbersArray();
	var a = array[0], b = array[1], s = array[2];

	if (a + b > s) return 'No';
	if (a + b === s) return 'Yes';
	return ((s - a - b) % 2 === 0) ? 'No' : 'Yes';
})());

var tok = null;
var index = 0;
function next() {
    while (tok == null || index == tok.length) {
        tok = readline().split(' ');
        index = 0;
    }
    var res = tok[index++];
    return res;
}

function nextInt() {
    return parseInt(next());
}

function sortNumber(a, b) {
    return a - b;
}

function main() {
        var a=nextInt();
var b=nextInt();
var s=nextInt();
var c=a+b;
if(s>=c&&(s-c)%2==0){
print("Yes");
}else{
print("No");
}
}

main();

        var app = {
            'main' : function main()    {
                var result = 'NO',
                    targetX, targetY, stepCount,
                    minStepCount;

                targetX = readline().split(/\s/gi).map(Number);
                targetY = targetX[1];
                stepCount = targetX[2];
                targetX = targetX[0];

                minStepCount = targetX + targetY;

                if(stepCount >= minStepCount)   {
                    if((stepCount - minStepCount) % 2 == 0) result = 'YES';
                    else    result = 'NO';
                }

                print(result);
            }
        };

app.main();


var year = parseInt(readline());
var isCurrYearLeap = isLeap(year);
var diff = 0;
function isLeap(_year) {
	if (_year%4 !== 0){
		return false;
	} else if (_year%100 !== 0) {
		return true;
	} else if (_year%400 !== 0) {
		return false;
	} else {
		return true;
	}
}

while(true){
	if (isLeap(year)) {
		diff += 2;
	} else {
		diff += 1;
	}
	year++;
	if(diff % 7 === 0 && isLeap(year) === isCurrYearLeap){
		break;
	}
}

print(year);

input = readline().split(' ');
d = 0;
temp_year = year = parseInt(input[0]);
while (true) {
        if (!(d % 7) && is_leap(year) == is_leap(temp_year) && d) {
                print(temp_year);
                break
        }
        temp_year++;
        d += (is_leap(temp_year) ? 366 : 365)
}

function is_leap(year) {
        return (!(year % 400) || (year % 100)) && !(year % 4)
}


'use strict'

const N = +readline()

let s = getSimples(N)

let as = []

o: for (let i = 6; i <= N; i++) {
  let dc = 0
  for (let j = 0; j < s.length; j++) {
    if (!(i % s[j])) dc++
  }
  if (dc == 2) as.push(i)
}

print(as.length)

function getSimples (n) {
  let simples = [2]
  o: for (let i = 3; i <= n; i++) {
    for (let j = 0; j < simples.length | 0; j++) {
      if (!(i % simples[j])) continue o
    }
    simples.push(i)
  }
  return simples
}

const readline = require('readline');

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

function isPrime(num) {
    if (num == 2) return true;
    if (num % 2 == 0 || num < 2) return false;
    let s = Math.sqrt(num);
    for (let i = 3; i <= s; i+=2) {
        if (num % i == 0) return false;
    }
    return true;
};

function hasExactlyTwoPrimeDivis(num) {
    var counter = 0;
    for (var i = 2; i < num; i++) {
        if (num % i == 0 && isPrime(i))
            counter++;
        if (counter > 2)
            return false;

    }
    return counter==2;
}

rl.on('line', (input) => {
    var N = parseInt(input);
    var ans = 0;
    for (let i = 6; i <= N; i++)
          ans+=hasExactlyTwoPrimeDivis(i);

     console.log(ans);
     rl.close();
});

const readline = require('readline');

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

rl.on('line', function (input) {
   // myArr = input.split(' ').map(item => {return parseInt(item);});
var N = parseInt(input);
var Primes = [];
for(var i = 2; i <= N; i++)
    if (IsPrime(i)) Primes.push(i);

var ans = 0;
for (var i = 1; i <= N; i++)
    if (IsAlmostPrime(i, Primes)) ans++;

console.log(ans);

    rl.close();
})

//******************************MY FUNCTIONS */

function IsPrime(n)
{
    if (n == 2 ) return true;
    if (n <= 1|| n%2==0)
        return false;
        //for (int i = 2; i <= n/2; i++)
        //    if (n % i == 0)
        //        return false;
      var limit = parseInt(Math.sqrt(n));
    for (var i = 3; i <= limit; i+=2)
        if (n % i == 0)
           return false;

    return true;
}

function IsAlmostPrime(n, pNums)
{
    var countDivisor = 0;
    for (var i = 0; i < pNums.length; i++)
    {
        if (n % pNums[i] == 0) countDivisor++;
        if (pNums[i] > n / 2) break;
    }
    return countDivisor == 2;
}

var n = +readline(),
    nums = new Array(n + 1).fill(1);

for (var i = 2; i <= n; i ++)
{
  if (nums[i] === 1)
  {
    for (var j = 2 * i; j <= n; j += i)
    {
      nums[j] ++;
    }
  }
}

var total = 0;
for (var i = 2; i <= n; i ++)
{
  if (nums[i] === 3)
  {
    total ++;
  }
}

print(total);

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++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const n = +readLine();

  function countAlmostPrimes(n) {
    const primes = getAllPrimesUpto(n);
    let almostPrimeCount = 0;

    for (let i = 1; i <= n; i++) {
      let count = 0;
      let j = 0;
      while (primes[j] < i && j < n) {
        if (i % primes[j] === 0) count++;
        j++;
      }
      if (count === 2) almostPrimeCount++;
    }
    return almostPrimeCount;
  }

  console.log(countAlmostPrimes(n));
}

function getAllPrimesUpto(n) {
  const primes = [];
  for (let i = 2; i <= n; i++) {
    let isPrime = true;
    for (let j = 2; j <= Math.floor(Math.sqrt(i)); j++) {
      if (i % j === 0) {
        isPrime = false;
        break;
      }
    }
    if (isPrime) primes.push(i);
  }

  return primes;
}

const readline = require('readline');

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

var isPrime = function (n) {
    if (n === 2)
        return true;
    if (n % 2 === 0) return false;
    let limit = parseInt(Math.sqrt(n));
    for (let i = 3; i <= limit; i += 2) {
        if (n % i === 0)
            return false;
    }
    return true;
}

var hasExactlyTwoPrimeDivs = function (n) {
    let counter = 0, limit = parseInt(n / 2);
    for (let i = 2; i <= limit; i++)
        counter += (n % i == 0 && isPrime(i));

    return counter == 2;
}

rl.on('line', function (input) {
    let n = parseInt(input), ans = 0;
    for (let i = 6; i <= n; i++)
        ans += hasExactlyTwoPrimeDivs(i);
    console.log(ans);
    rl.close();

});

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

const getPrimes = (d) => {
  const maxN = d;
  const arr = new Array(maxN + 1).fill(1);
  arr[0] = 0;
  arr[1] = 0;

  for (let i = 2; i*i <= maxN; i++) {
    if (arr[i]) {
      for (let j = i*i; j <= maxN; j += i) {
        arr[j] = 0;
      }
    }
  }

  const primes = [];

  for (let i = 0; i < arr.length; i++) {
    if (arr[i]) {
      primes.push(i);
    }
  }

  return primes;
}

rl.on('line', (d) => {
  const primes = getPrimes(+d);

  let ans = 0;

  for (let i = 6; i <= +d; i++) {
    let primeDivisors = 0;
    for (let p = 0; p < primes.length; p++) {
      if (i % primes[p] === 0) {
        primeDivisors++;
      }
    }

    if (primeDivisors === 2) {
      ans++;
    }
  }

  console.log(ans);
  c++;
});

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++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const n = +readLine();

  function countAlmostPrimes(n) {
    const primes = getAllPrimesUpto(n);
    let almostPrimeCount = 0;

    for (let i = 1; i <= n; i++) {
      let count = 0;
      let j = 0;
      while (primes[j] < i && j <= n) {
        if (i % primes[j] === 0) count++;
        if (count >= 2) {
          almostPrimeCount++;
          break;
        }
        j++;
      }
    }
    return almostPrimeCount;
  }

  console.log(countAlmostPrimes(n));
}

function getAllPrimesUpto(n) {
  const primes = [];
  for (let i = 2; i <= n; i++) {
    let isPrime = true;
    for (let j = 2; j <= Math.floor(Math.sqrt(i)); j++) {
      if (i % j === 0) {
        isPrime = false;
        break;
      }
    }
    if (isPrime) primes.push(i);
  }

  return primes;
}

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++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  function countAlmostPrimes(n) {
    const primes = getAllPrimesUpto(n);
    let almostPrimeCount = 0;

    for (let i = 1; i <= n; i++) {
      let count = 0;
      let j = 0;
      while (primes[j] < i && j <= n) {
        if (i % primes[j] === 0) count++;
        if (count >= 2) {
          almostPrimeCount++;
          break;
        }
        j++;
      }
    }
    return almostPrimeCount;
  }

  console.log(countAlmostPrimes(3000));
}

function getAllPrimesUpto(n) {
  const primes = [];
  for (let i = 2; i <= n; i++) {
    let isPrime = true;
    for (let j = 2; j <= Math.floor(Math.sqrt(i)); j++) {
      if (i % j === 0) {
        isPrime = false;
        break;
      }
    }
    if (isPrime) primes.push(i);
  }

  return primes;
}

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

const getPrimes = () => {
  const maxN = 25;
  const arr = new Array(maxN + 1).fill(1);
  arr[0] = 0;
  arr[1] = 0;

  for (let i = 2; i*i <= maxN; i++) {
    if (arr[i]) {
      for (let j = i*i; j <= maxN; j += i) {
        arr[j] = 0;
      }
    }
  }

  const primes = [];

  for (let i = 0; i < arr.length; i++) {
    if (arr[i]) {
      primes.push(i);
    }
  }

  return primes;
}

rl.on('line', (d) => {
  const primes = getPrimes();

  let ans = 0;

  for (let i = 6; i <= +d; i++) {
    let primeDivisors = 0;
    for (let p = 0; p < primes.length; p++) {
      if (primes[p] > i) {
        break;
      }

      if (i % primes[p] === 0) {
        primeDivisors++;
      }
    }

    if (primeDivisors === 2) {
      ans++;
    }
  }

  console.log(ans);
  c++;
});


/* TEST CASE
input
5 2 3
output
20 15
input
8 2 4
output
35 32
 */
function main() {
	var splitted = readline().split(" ");
	var nParticipants = parseInt(splitted[0]);
	var nBottlesPerEachPersons = parseInt(splitted[1]);
	var nTowelsPerEachPersons = parseInt(splitted[2]);
	var nTowels = nTowelsPerEachPersons * nParticipants;
	var nBottles = 0;

	while (nParticipants > 1) {
		var nPersons = 1 << Math.floor(Math.log(nParticipants)/Math.LN2);
		var nJudges = nPersons / 2;

		nBottles += nBottlesPerEachPersons * nPersons + nJudges;
		nParticipants -= nJudges;
	}
	print(nBottles, nTowels);
}

main();

var str = readline().split(" ", 3);
var n = Number(str[0]), b = Number(str[1]), p = Number(str[2]);

var pa = n * p;

var sum = 0;
while(n !== 1) {
    var k = 1;
    while (k * 2 <= n) {
        k *= 2;
    }
    n = n % k + k / 2;
    sum += k / 2;
}

print(sum * (2 * b + 1) + " " + pa);

function main() {

    var arr = readline().split(' ');
    var n = arr[0], b = arr[1], p = arr[2];

    var numberOfTowels = n*p;
    var bottlePerMatches = 2*b + 1;
    var totalMatches = 0;
    var matchesOfRound = 0;
    var next = 0;

    if(n == 1){
        print(0+' '+p);
    }else {

    while (Math.floor(n/2)){
        matchesOfRound = Math.floor(n/2);
        next  = n%2;
        totalMatches += matchesOfRound;

        n = matchesOfRound + next;
    }

    print(totalMatches*bottlePerMatches + ' ' + numberOfTowels);
    }

}

main();

function main() {

    var arr = readline().split(' ');
    var n = arr[0], b = arr[1], p = arr[2];

    var numberOfTowels = n*p;
    var bottlePerMatches = 2*b + 1;
    var totalMatches = 0;
    var matchesOfRound = 0;
    var next = 0;

    if(n == 1){
        print((b+1)+' '+p);
    }

    while (Math.floor(n/2)){
        matchesOfRound = Math.floor(n/2);
        next  = n%2;
        totalMatches += matchesOfRound;

        n = matchesOfRound + next;
    }

    print(totalMatches*bottlePerMatches + ' ' + numberOfTowels);

}

main();

function main() {

    var arr = readline().split(' ');
    var n = arr[0], b = arr[1], p = arr[2];

    var numberOfTowels = n*p;
    var bottlePerMatches = 2*b + 1;
    var totalMatches = 0;
    var matchesOfRound = 0;
    var next = 0;

    if(n == 1){
        print(0+' '+p);
    }

    while (Math.floor(n/2)){
        matchesOfRound = Math.floor(n/2);
        next  = n%2;
        totalMatches += matchesOfRound;

        n = matchesOfRound + next;
    }

    print(totalMatches*bottlePerMatches + ' ' + numberOfTowels);

}

main();


var input = readline().split(' ').map(function(e){return parseInt(e);});
var min = function(a){
var res = a[0];
a.forEach(function(e){res=(res>e?e:res);});
return res;
};
print(min([input[0],input[1],Math.floor(input[2]/2), Math.floor(input[3]/7), Math.floor(input[4]/4)    ]    ));

const input = readline().split(" ").map(x => Number(x));
print(Math.min(input[0], input[1], Math.floor(input[2] * 0.5), Math.floor(input[3] * 0.14285714285714285), Math.floor(input[4] * 0.25)));

const input = readline().split(" ").map(x => Number(x));
const aquaFortis = input[0];
const aquaRegia = input[1];
const amalgama = input[2];
const minium = input[3];
const vitriol = input[4];
print(Math.min(aquaFortis, aquaRegia, Math.floor(amalgama * 0.5), Math.floor(minium * 0.14285714285714285), Math.floor(vitriol * 0.25)));

function min(a, b)
{
	if(a < b) return a;
	return b;
}

var a = readline().split(" ").map(function(x) {return parseInt(x);});
var dv = [1, 1, 2, 7, 4], ans;
ans = a[0];
for(var i = 1; i < 5; ++i) ans = min(ans, parseInt(a[i] / dv[i]));
print(ans);

var input = readline().split(' ').map(function(e){return parseInt(e);});
var min = function(a){
var res = a[0];
a.forEach(function(e){res=(res>e?e:res);});
return res;
};
print(min([input[0],input[1],Math.floor(input[2]/2), Math.floor(input[3]/6), Math.floor(input[4]/4)    ]    ));


var nm = readline().trim().split(' ');
var a=nm[0],k=parseInt(nm[1]);

var cursor = 0;
var iMaxi = 0;

while(k>0 && cursor<a.length){
    //print(';;;;cursor',cursor);
    var found = false;
    var maxi=a[cursor];
    for(var i=(cursor+1);i<=Math.min(cursor+k,a.length-1);i++){
        //print('com',maxi,a[i])
        if(maxi<a[i]){
          //  print(maxi,a[i])
            found=true;
            iMaxi=i;
            maxi = a[i];
        }
    }
    if(found){
      //  print("----",a.substring(0,cursor), maxi,a.substring(cursor,iMaxi), a.substring(iMaxi+1))
        a =a.substring(0,cursor)+ maxi+a.substring(cursor,iMaxi)+ a.substring(iMaxi+1);

       // print('nbr',iMaxi,cursor,iMaxi-cursor)
        k-=iMaxi-cursor;

    }
    cursor++;

//n    print("====",a)
}
print(a);

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 data = tokenize(readline()),
		digits = data[0].split(''), n = digits.length,
		swapNum = parseInt(data[1]);
	for (var i = 0; i < digits.length; ++i) {
		digits[i] = parseInt(digits[i]);
	}
	for (var pos = 0; swapNum > 0 && pos < n; ++pos) {
		var max = digits[pos], best = pos,
			limit = Math.min(pos+swapNum, n-1);
		for (var seek = pos+1; seek <= limit; ++seek) {
			if (digits[seek] > max) {
				best = seek;
				max = digits[seek];
			}
		}
		if (best != pos) {
			for (var i = best; i > pos; --i) {
				digits[i] = digits[i-1];
			}
			digits[pos] = max;
			swapNum -= (best-pos);
		}
	}
	print(digits.join(''));
}

main();

var tmp = readline().split(' '),
    a = tmp[0].split(''), n, m, k = parseInt(tmp[1]), i, j, x,
    swap = function(p, q) {
        var t = a[q], i;
        for (i = q; i > p; i--) {
            a[i] = a[i - 1];
        }
        a[p] = t;
    };

for (i = 0, n = a.length - 1; i < n && k > 0; i++) {
    out:
    for (x = 9; x > a[i]; x--) {
        for (j = i + 1, m = Math.min(n, i + k); j <= m; j++) {
            if (a[j] == x) {
                swap(i, j);
                k -= (j - i);
                break out;
            }
        }
    }
}

print(a.join(''));

var line = readline().split(' ')
var a = line[0].split("")
var k = parseInt(line[1])

for (var i = 0; i + 1 < a.length; i++) {
	var p = i
	for (var j = 1; j <= k && i + j < a.length; j++) {
		var q = i + j
		if (a[q] > a[p]) p = q
	}

	for (var j = p - 1; j >= i; j--) {
		var t = a[j]
		a[j] = a[j + 1]
		a[j + 1] = t
	}

	k -= p - i
}

print(a.join(""))

var line = readline().split(' ')
var a = line[0].split("")
var k = parseInt(line[1])

for (var i = 0; i + 1 < a.length; i++) {
	var p = i
	for (var j = 1; j <= k && i + j < a.length; j++) {
		var q = i + j
		if (a[q] > a[p]) p = q
	}

	var t = a[i]
	a[i] = a[p]
	a[p] = t

	k -= p - i
}

print(a.join(""))

var line = readline().split(' ')
var a = line[0].split("")
var k = parseInt(line[1])

for (var i = 0; i + 1 < a.length; i++) {
	var p = i
	for (var j = 0; j < k && i + j < a.length; j++) {
		var q = i + j
		if (a[q] > a[p]) p = q
	}

	var t = a[i]
	a[i] = a[p]
	a[p] = t

	k -= p - i
}

print(a.join(""))

var nm = readline().trim().split(' ').map((x)=>parseInt(x));
var a=nm[0]+"",k=nm[1];

var cursor = 0;
var iMaxi = 0;

while(k>0 && cursor<a.length){
    //print(';;;;cursor',cursor);
    var found = false;
    var maxi=a[cursor];
    for(var i=(cursor+1);i<=Math.min(cursor+k,a.length-1);i++){
        //print('com',maxi,a[i])
        if(maxi<a[i]){
          //  print(maxi,a[i])
            found=true;
            iMaxi=i;
            maxi = a[i];
        }
    }
    if(found){
       // print("----",a.substring(0,cursor), maxi,a.substring(cursor,iMaxi), a.substring(iMaxi+1))
        a =a.substring(0,cursor)+ maxi+a.substring(cursor,iMaxi)+ a.substring(iMaxi+1);

       // print('nbr',iMaxi,cursor,iMaxi-cursor)
        k-=iMaxi-cursor;

    }
    cursor++;

//n    print("====",a)
}
print(a);

var nm = readline().trim().split(' ').map((x)=>parseInt(x));
var a=nm[0]+"",k=nm[1];

var cursor = 0;
var iMaxi = 0;

while(k>0 && cursor<a.length){
    //print('cursor',cursor);
    var found = false;
    var maxi=a[cursor];
    for(var i=(cursor+1);i<=(cursor+k);i++){
      //  print('com',maxi,a[i])
        if(maxi<a[i]){
        //    print(maxi,a[i])
            found=true;
            iMaxi=i;
            maxi = a[i];
        }
    }
    if(found){
        //print("----",a.substring(0,cursor), maxi,a.substring(cursor,iMaxi), a.substring(iMaxi+1))
        a =a.substring(0,cursor)+ maxi+a.substring(cursor,iMaxi)+ a.substring(iMaxi+1);

        //print('nbr',iMaxi,cursor,iMaxi-cursor)
        k-=iMaxi-cursor;
        cursor=iMaxi+1;
    }else{
        cursor++;
    }
}
print(a);


(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var a = read.arrNumber(' ');
    var ncount = Math.floor(a[0] / 3);

    var n2 = Math.floor(a[1] / 2);
    if (n2 < ncount) ncount = n2;

    var n3 = Math.floor(a[2] / 2);
    if (n3 < ncount) ncount = n3;

    a[0] -= ncount * 3;
    a[1] -= ncount * 2;
    a[2] -= ncount * 2;

    var sdcount = 0;
    var rf = [0,1,2,0,2,1,0];
    for(var i = 0; i < 7; i++) {
        var test = [...a];
        var end = false;
        var sum = 0;
        var myi = i;

        while (!end) {
            if(test[rf[myi]] === 0) {
                end = true
            }
            else {
                sum ++;
                test[rf[myi]]--;
                myi++;
                if(myi === 7) {
                    myi = 0;
                }
            }

        }
        if(sdcount < sum) {
            sdcount = sum;
        }
    }

    print((ncount * 7) + +sdcount);
}());

'use strict';

const fs = require('fs');

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++].split(' ');
}

function readInt(s) {
    return parseInt(s, 10);
}

function readIntArray(a) {

    return a.map(e => parseInt(e, 10));
}

function solve(n) {
    let a = [0, 1, 2, 0, 2, 1, 0];
    let max = 0;
    for (let i = 0; i < 7; i++) {
        let korm = n.slice(0);
        let days = 0;
        let ok = true;
        for (let j = i; j < 7; j++) {
            if (korm[a[j]] > 0) {
                korm[a[j]]--;
                days++;
            } else {
                ok = false;
                break;
            }
        }
        if (!ok) {
            if (days > max) max = days;
            continue;
        }
        let weeks = Math.min(Math.floor(korm[0] / 3), Math.floor(korm[1] / 2), Math.floor(korm[2] / 2));
        days += weeks * 7;
        korm[0] -= 3 * weeks;
        korm[1] -= 2 * weeks;
        korm[2] -= 2 * weeks;
        for (let j = 0; j < 7; j++) {
            if (korm[a[j]] > 0) {
                korm[a[j]]--;
                days++;
            } else {
                break;
            }
        }
        if (days > max) max = days;
    }
    return max;
}

function main() {

    const a = readIntArray(readLine());
    let result = solve(a);
    console.log(result);
}

'use strict';

const fs = require('fs');

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++].split(' ');
}

function readInt(s) {
    return parseInt(s, 10);
}

function readIntArray(a) {
    return a.map(e => parseInt(e, 10));
}

function solve(n) {
    let a = [0, 1, 2, 0, 2, 1, 0];
    let max = 0;
    for (let i = 0; i < 7; i++) {
        let korm = n.slice(0);
        let days = 0;
        let ok = true;
        for (let j = i; j < 7; j++) {
            if (korm[a[j]] > 0) {
                korm[a[j]]--;
                days++;
            } else {
                ok = false;
                break;
            }
        }
        if (!ok) {
            if (days > max) max = days;
            continue;
        }
        let weeks = Math.min(Math.floor(a[0] / 3), Math.floor(a[1] / 2), Math.floor(a[2] / 2));
        days += weeks * 7;
        korm[0] -= 3 * weeks;
        korm[1] -= 2 * weeks;
        korm[2] -= 2 * weeks;
        for (let j = 0; j < 7; j++) {
            if (korm[a[j]] > 0) {
                korm[a[j]]--;
                days++;
            } else {
                break;
            }
        }
        if (days > max) max = days;
    }
    return max;
}

function main() {

    const a = readIntArray(readLine());

    let result = solve(a);
    console.log(result);
}