///////////////////////////////////////////////////
//http://codeforces.com/contest/1073/problem/D
var param = `5184`;

param = param.split('\n');
var paramInd = 0;

function readline() {
    return param[paramInd++]
}

function print(str) {
    console.log(str)
}

var BigNum = {

    plus: function plus(number1, number2, minus1, minus2) {

        if (typeof number1 === 'number' && Math.abs(number1) < BigNum.limit2 &&
            typeof number2 === 'number' && Math.abs(number2) < BigNum.limit2)

            return number1 + number2;

        var result = [];

        var ranks1 = BigNum._getRanks(number1);
        var ranks2 = BigNum._getRanks(number2);

        if (minus1 === undefined) minus1 = ranks1.minus;
        if (minus2 === undefined) minus2 = ranks2.minus;

        if (!minus1) {
            if (minus2) {
                return BigNum.minus(ranks1, ranks2, false, false);
            }
        } else if (!minus2) {
            return BigNum.minus(ranks2, ranks1, false, false);
        } else {
            result.minus = true;
        }

        var maxRank = Math.max(ranks1.length, ranks2.length);
        for (var i = 0; i < maxRank; i++) {
            result[i] = (result[i] || 0)
                + (ranks1[i] || 0)
                + (ranks2[i] || 0);

            if (result[i] >= BigNum.limit) {
                result[i + 1] = 1;
                result[i] -= BigNum.limit;
            }
        }

        return result;
    },

    minus: function minus(number1, number2, minus1, minus2) {

        if (typeof number1 === 'number' && number1 < BigNum.limit2 &&
            typeof number2 === 'number' && number2 < BigNum.limit2)

            return number1 - number2;

        var result = [];

        var ranks1 = BigNum._getRanks(number1);
        var ranks2 = BigNum._getRanks(number2);

        if (minus1 === undefined) minus1 = ranks1.minus;
        if (minus2 === undefined) minus2 = ranks2.minus;

        if (!minus1) {
            if (minus2) {
                return BigNum.plus(ranks1, ranks2, false, false);
            }
        } else if (!minus2) {
            result = BigNum.plus(ranks1, ranks2, false, false);
            result.minus = true;
            return result;
        } else {
            return BigNum.minus(ranks2, ranks1, false, false);
        }

        var maxRank = Math.max(ranks1.length - 1, ranks2.length - 1);
        for (var i = maxRank; i >= 0; i--) {

            result[i] = (ranks1[i] || 0)
                - (ranks2[i] || 0);

            if (result[i] < 0) {
                if (result.minus === undefined) {
                    result.minus = true;
                    result[i] = -result[i];

                    var swap = ranks1;
                    ranks1 = ranks2;
                    ranks2 = swap;
                } else {
                    var j = i;
                    do {
                        result[j + 1] -= 1;
                        result[j] += BigNum.limit;
                    } while (result[++j] < 0);
                }
            } else if (result.minus === undefined && result[i] > 0) {
                result.minus = false;
            }
        }

        while(result[result.length - 1] === 0) {
            result.pop();
        }
        if (result.length < 3) {
            return BigNum.toInt(result);
        }

        return result;
    },

    multiply: function multiply(number1, number2) {

        if (typeof number1 === 'number' && number1 < BigNum.limit &&
            typeof number2 === 'number' && number2 < BigNum.limit)

            return number1 * number2;

        var result = [];

        var ranks1 = BigNum._getRanks(number1);
        var ranks2 = BigNum._getRanks(number2);

        for (var i = 0; i < ranks1.length; i++) {
            for (var j = 0; j < ranks2.length; j++) {
                var rank = i + j;
                var prod = ranks1[i] * ranks2[j];
                if (prod > BigNum.limit) {
                    result[rank] = (result[rank] || 0)
                        + prod % BigNum.limit;
                    result[rank + 1] = (result[rank + 1] || 0)
                        + Math.floor(prod / BigNum.limit);
                } else {
                    result[rank] = (result[rank] || 0)
                        + prod;
                }
            }
        }

        for (i = 0; i < result.length; i++) {
            if (result[i] > BigNum.limit) {
                result[i] -= BigNum.limit;
                result[i + 1] = (result[i + 1] || 0) + 1;
            }
        }

        result.minus = (ranks1.minus != ranks2.minus);
        return result;
    },

    divide: function divide(number1, number2) {

        if (typeof number1 === 'number' && number1 < BigNum.limit2 &&
            typeof number2 === 'number' && number2 < BigNum.limit2)

            return number1 / number2;

        var ranks1 = BigNum._getRanks(number1);
        var ranks2 = BigNum._getRanks(number2);

        var result = BigNum.toStr(ranks1) / BigNum.toStr(ranks2);
        return result;
    },

    ////////////////////////////////////////////////
    // comparision
    more: function more(number1, number2) {
        return BigNum.compare(number1, number2) > 0;
    },

    less: function less(number1, number2) {
        return BigNum.compare(number1, number2) < 0;
    },

    equal: function equal(number1, number2) {
        return BigNum.compare(number1, number2) === 0;
    },

    max: function max(number1, number2) {
        if(number2 !== undefined) {
            return BigNum.more(number1, number2) ? number1 : number2;
        }

        var numberArr = number1;
        var max = numberArr[0];

        for(var i = 1; i < numberArr.length; i++) {
            if(BigNum.more(numberArr[i], max)) {
                max = numberArr[i];
            }
        }

        return max;
    },

    min: function max(number1, number2) {
        if(number2 !== undefined) {
            return BigNum.compare(number1, number2) < 0 ? number1 : number2;
        }

        var numberArr = number1;
        var min = numberArr[0];

        for(var i = 1; i < numberArr.length; i++) {
            if(BigNum.compare(numberArr[i], min) < 0) {
                min = numberArr[i]
            }
        }

        return min;
    },

    compare: function compareNumbers(number1, number2) {
        var numberTypes = [typeof number1, typeof number2];

        if(numberTypes[0] === numberTypes[1]) {
            if(numberTypes[0] === 'number') {
                return number1 - number2;
            }
        } else {
            if (numberTypes[1] === 'number') {
                if (number1[2]) {
                    return 1;
                }
            } else if (numberTypes[0] === 'number') {
                if(number2[2]) {
                    return -1;
                }
            }
        }

        var ranks1 = BigNum._getRanks(number1);
        var ranks2 = BigNum._getRanks(number2);

        var diff;

        if(ranks1.minus !== ranks2.minus) {
            return !ranks1.minus > !ranks2.minus ? 1 : -1
        } else if(diff = ranks1.length - ranks2.length) {
            return diff;
        }

        for (var i = ranks1.length - 1; i >= 0; i--) {
            if(diff = ranks1[i] - ranks2[i])  {
                return diff;
            }
        }

        return 0;
    },

    toInt: function (number) {
        if (typeof number === 'object') {
            if(!number.length) return 0;
            else return +BigNum.toStr(number);
        }
        else return +number;
    },

    toStr: function (number) {

        if (typeof number === 'string') return number;
        else if(typeof number === 'number') return '' + number;

        var str = '';
        for (var i = 0; i < number.length - 1; i++) {
            str = ('000000' + number[i]).substr(-7) + str;
        }
        str = number[i] + str;
        return (number.minus ? '-' : '') + str;
    },

    getBig: function (number) {
        if (typeof number === 'string') {
            if (number.length < 16) return +number;
        }

        return BigNum._getRanks(number);
    },

    _getRanks: function (number) {

        if (typeof number === 'object') {
            return number;
        } else if (typeof number === 'number') {
            number = '' + number;
        }

        var ranks = [];
        if (number[0] === '-') {
            ranks.minus = true;
            number = number.substr(1);
        }

        if (number.length > 7) {

            number = '' + number;
            for (var i = 7; i <= number.length; i += 7) {
                ranks.push(+number.substr(-i, 7));
            }

            var rest = number.length % 7;
            if (rest) {
                ranks.push(+number.substr(0, rest));
            }

        } else {
            ranks.push(+number);
        }

        if (ranks[ranks.length - 1] < 0) {
            ranks[ranks.length - 1] = -ranks[ranks.length - 1];
            ranks.minus = true;
        }

        return ranks;
    },

    rand: function getRandomInt(min, max) {
        return Math.floor(Math.random() * (max - min)) + min;
    },

    /*runTests: function tests(count = 10) {
        var correct = 0;
        var values = [];
        for(var i = 0; i < count; i++) {
            var val1 = BigNum.rand(-999999999999999, 999999999999999);
            var val2 = BigNum.rand(-999999999999999, 999999999999999);

            var resBn = BigNum.plus(val1, val2);
            var resBnInt = BigNum.toInt(resBn);
            var res = val1 + val2;

            if(resBnInt !== res) {
                console.log('!!! ' + val1 + ' + ' + val2);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            resBn = BigNum.minus(val1, val2);
            resBnInt = BigNum.toInt(resBn);
            res = val1 - val2;

            if(resBnInt !== res) {
                console.log('!!! ' + val1 + ' - ' + val2);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            resBn = BigNum.divide(val1, val2);
            resBnInt = Math.round(resBn, 4);
            res = Math.round(val1 / val2, 4);

            if(resBnInt !== res) {
                console.log('!!! ' + val1 + ' / ' + val2);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            resBn = BigNum.more(val1, val2);
            res = val1 > val2;

            if(resBn !== res) {
                console.log('!!! ' + val1 + ' > ' + val2);
                console.log('   Bn: ' + resBn);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            resBn = BigNum.less(val1, val2);
            res = val1 < val2;

            if(resBn !== res) {
                console.log('!!! ' + val1 + ' < ' + val2);
                console.log('   Bn: ' + resBn);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            resBn = BigNum.equal(val1, val2);
            res = val1 === val2;

            if(resBn !== res) {
                console.log('!!! ' + val1 + ' === ' + val2);
                console.log('   Bn: ' + resBn);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            resBn = BigNum.equal(val1, val1);
            res = val1 === val1;

            if(resBn !== res) {
                console.log('!!! ' + val1 + ' === ' + val1);
                console.log('   Bn: ' + resBn);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            var resBn = BigNum.max(val1, val2);
            var resBnInt = BigNum.toInt(resBn);
            var res = Math.max(val1, val2);

            if(resBnInt !== res) {
                console.log('!!! max ' + val1 + ', ' + val2);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            var resBn = BigNum.min(val1, val2);
            var resBnInt = BigNum.toInt(resBn);
            var res = Math.min(val1, val2);

            if(resBnInt !== res) {in
                console.log('!!! min ' + val1 + ', ' + val2);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            var val3 = BigNum.rand(-999999999999999, 999999999999999);
            var resBn = BigNum.max([val1, val2, val3]);
            var resBnInt = BigNum.toInt(resBn);
            var res = Math.max(val1, val2, val3);

            if(resBnInt !== res) {
                console.log('!!! max ' + val1 + ', ' + val2 + ', ' + val3);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            var resBn = BigNum.min([val1, val2, val3]);
            var resBnInt = BigNum.toInt(resBn);
            var res = Math.min(val1, val2, val3);

            if(resBnInt !== res) {
                console.log('!!! min ' + val1 + ', ' + val2 + ', ' + val3);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

            val1 = BigNum.rand(-99999999, 99999999);
            val2 = BigNum.rand(-9999999, 9999999);

            resBn = BigNum.multiply(val1, val2);
            resBnInt = BigNum.toInt(resBn);
            res = Math.round(val1 * val2, 4);

            if(resBnInt !== res) {
                console.log('!!! ' + val1 + ' * ' + val2);
                console.log('   Bn: ' + resBnInt);
                console.log('   Nm: ' + res);
            } else {
                correct++;
            }

        }
        console.log('correct:' + correct);

    },*/
    /*runTimeTests: function timeTests(count = 10000, ranks = 15) {

        var max = Math.pow(10, ranks);

        var values = [];
        for(var i = 0; i < count; i++) {
            var val1 = BigNum.rand(-max, max);
            var val2 = BigNum.rand(-max, max);

            values.push([val1, val2]);
        }

        var testF = function (funcs, operation) {
            var results = [];
            for(var f = 0; f < 2; f++) {
                var func = funcs[f];
                var t = performance.now();
                for(var i = 0; i < count; i++) {
                    res = func(values[i][0], values[i][1]);
                }
                results[f] =  Math.floor(performance.now() - t);
            }

            console.log('test ' + operation + ': diff ' + (results[1] - results[0]));
        }

        var testsFuncs = {
            plus: [
                (val1, val2) => val1 + val2,
        (val1, val2) => BigNum.plus(val1, val2),
    ],

        minus: [
            (val1, val2) => val1 - val2,
            (val1, val2) => BigNum.minus(val1, val2),
    ],

        divide: [
            (val1, val2) => val1 / val2,
            (val1, val2) => BigNum.divide(val1, val2),
    ],

        miltiply: [
            (val1, val2) => val1 * val2,
            (val1, val2) => BigNum.multiply(val1, val2),
    ],
    };

        for(k in testsFuncs) {
            testF(testsFuncs[k], k);
        }
    },*/

    limit: 10000000,
    limit2: 100000000000000,
}

function rand(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
}

/////////////////////////////////////////
// CODE START

//1. Reading data

var n = readline();
var actions = 0;
var multiply = 0;
while (true) {
    var square = Math.sqrt(n);
    if (square !== Math.round(square)) {
        var start = Math.ceil(square);
        var step = 2 - n % 2;
        start += start % step;

        var finish = n / (4 - step);

        for (var i = start; i <= finish; i += step) {
            if (Math.pow(i, 2) % n === 0) break;
        }
        if (i <= n / 2) {
            actions += 1;
            multiply = 1;
            n = i;
        } else {
            break;
        }
    } else {
        actions += 1;
        n = square;
    }
}

print('' + n + ' ' + (actions + multiply));


var n = readline();
var actions = 0;
while (true) {
    var square = Math.sqrt(n);
    if (square !== Math.round(square)) {
        var step = 2 - n % 2;

        for (var i = 2; i < square; i += step) {
            if (n % i === 0) {
               var div = n / i;
               if(n % 2 || div % 2 === 0) break;
            }
        }
        if (i < square) {
            actions += 2;
            n = n / i;
        } else {
            break;
        }
    } else {
        actions += 1;
        n = square;
    }
}

print('' + n + ' ' + actions);


function getSimpleDividers(num) {

    var dividersMap = {};
    var dividers = [];

    var sqrt = Math.sqrt(num), i = 2;
    while(i <= sqrt) {
        if(num % i === 0) {
            if(!(i in dividersMap)) {
                dividersMap[i] = 1;
                dividers.push(i);
            }

            sqrt = Math.sqrt(num = num / i);
        } else {
            i++;
        }
    }

    if(!(num in dividersMap)) dividers.push(num);

    return dividers;
}

function doTask(num) {
    var cnt = 0;

    var product = 1;
    var divs = getSimpleDividers(num);

    for(var i = 0; i < divs.length; i++) product *= divs[i];
    if(product !== num) {
        cnt += 2;
    }

    var p = product;
    while((p *= p) % num !== 0) cnt++;

    print('' + product + ' ' + cnt);
}

doTask(+readline());


var Axy = readline(); Axy = Axy.split(" "); Axy[0] = parseInt(Axy[0]); Axy[1] = parseInt(Axy[1]);
var Bxy = readline(); Bxy = Bxy.split(" "); Bxy[0] = parseInt(Bxy[0]); Bxy[1] = parseInt(Bxy[1]);
var Cxy = readline(); Cxy = Bxy.split(" "); Cxy[0] = parseInt(Cxy[0]); Cxy[1] = parseInt(Cxy[1]);
if((Cxy[0] - Axy[0])*(Bxy[1]-Axy[1]) - (Cxy[1] - Axy[1])*(Bxy[0]-Axy[0]) == 0){print("TOWARDS");}
else if((Cxy[0] - Axy[0])*(Bxy[1]-Axy[1]) - (Cxy[1] - Axy[1])*(Bxy[0]-Axy[0]) < 0){print("LEFT");}
else if((Cxy[0] - Axy[0])*(Bxy[1]-Axy[1]) - (Cxy[1] - Axy[1])*(Bxy[0]-Axy[0]) > 0){print("RIGHT");}


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [ils] = ipt.split(EOL).slice(0, -1)
  const [a, b, c, d, e, f] = ils.split(' ')
  if (b == 0 || d == 0 || f == 0) return console.log('Hermione')
  if (a == 0 || c == 0 || e == 0) return console.log('Ron')
  console.log(1 / a * b / c * d / e * f <= 1 ? 'Hermione' : 'Ron')
})


// sand a grams -> b grams lead
	// lead c grams -> d grams gold
	// gold e grams -> f grams sand
	// a : b, c : d, e : f
	// s : 125, l : 250, g : 150
	// 0 : stol, 1 : ltog, 2 : gtos
	var inputs = readline().split(/\s/gi).map(Number),
		stol = inputs[1] / inputs[0], ltog = inputs[3] / inputs[2], gtos = inputs[5] / inputs[4],
		stol = { 'rate' : 'stol', 'value' : isNaNCheck(stol) },
		ltog = { 'rate' : 'ltog', 'value' : isNaNCheck(ltog) },
		gtos = { 'rate' : 'gtos', 'value' : isNaNCheck(gtos) },
		turn = [],
		rates = [ stol.value, ltog.value, gtos.value ],
		maxRates = stol.value,
		init = 1000, send = 0, lead = 0, gold = 0, first = 0;

	rates.forEach(function(rate, index)	{
		if(rate >= maxRates)	{
			maxRates = rate;

			switch(index)	{
				case 0 :
					send = init;
					turn = [];
					turn.push(stol);
					turn.push(ltog);
					turn.push(gtos);
					first = 0;
					break;
				case 1 :
					lead = init;
					turn = [];
					turn.push(ltog);
					turn.push(gtos);
					turn.push(stol);
					first = 1;
					break;
				case 2 :
					gold = init;
					turn = [];
					turn.push(gtos);
					turn.push(stol);
					turn.push(ltog);
					first = 2;
					break;
			}
		}
	});

	checkLoop(init, turn);

	function checkLoop(init, turn)	{
		var loopValue = init;

		turn.forEach(function(rate)	{
			//console.log(rate);
			loopValue *= rate.value;
			//console.log(loopValue);
		});

		//console.log(loopValue, init);

		if(!isFinite(loopValue))	print('Ron');
		else if(loopValue > init) 	print('Ron');
		else	print('Hermione');
	}

	function isNaNCheck(value)	{
		return isNaN(value) ? 0 : value;
	}


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const [ils] = ipt.split(EOL).slice(0, -1)
  const [a, b, c, d, e, f] = ils.split(' ')

  if (c == 0 && d > 0) return console.log('Ron')
  if (b == 0 || d == 0 || f == 0) return console.log('Hermione')
  if (a == 0 || c == 0 || e == 0) return console.log('Ron')
  console.log(1 / a * b / c * d / e * f <= 1 ? 'Hermione' : 'Ron')
})


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.solveCase = function() {
        var res , i , j , fl , cn , temp , lim , mask , mi , ma , tot ;
        res = 0 ;
        lim = ( 1 << this.n ) ;
        for( i = 0 ; i < lim ; i++ ) {
        	mask = i ;
        	tot = 0 ;
        	mi = 1000000000000 ;
        	ma = -1 ;
        	for( j = 0 ; j < this.n ; j++ ) {
        		if( ( mask & ( 1 << j ) ) != 0 ) {
        			mi = Math.min( mi , this.arr[ j ] ) ;
        			ma = Math.max( ma , this.arr[ j ] ) ;
        			tot += this.arr[ j ] ;
        		}
        	}
        	if( tot >= this.l && tot <= this.r && ma - mi >= this.x ) {
        		res++ ;
        	}
        }
        print( res );
    };

    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.l = irObj.nextInt();
            this.r = irObj.nextInt();
            this.x = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
                this.arr.push( irObj.nextInt() ) ;
            }
        }
        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( -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();


const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, m] = lines[l++].trim().split(' ').map(Number)
        const grid = lines.slice(l, l + n).map(str => str.trim())
        l += n
        output[i] = solve(n, m, grid)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, grid) {
    const q = [[0, 0, 0]]
    let count = q.length
    const map = {}
    while (count) {
        while (count--) {
            const [x, y, c] = q.shift()
            const add = grid[x][y] === '.' ? 0 : 1
            if (x === n - 1 && y === m - 1) {
                map[c + add] = (map[c + add] || 0) + 1
            }
            // ans[x] = ans[x] || []
            // ans[x][y] = c
            if (x + 1 < n) q.push([x + 1, y, c + add])
            if (y + 1 < m) q.push([x, y + 1, c + add])
        }
        count = q.length
    }
    let ans
    let max = -1
    for (let k in map) {
        k = +k
        if (max < 0 || map[k] > ans || (map[k] === ans && k > max)) {
            max = k
            ans = map[k]
        }
    }
    // console.log(map)
    return max
}


const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, m] = lines[l++].trim().split(' ').map(Number)
        const grid = lines.slice(l, l + n).map(str => str.trim())
        l += n
        output[i] = solve(n, m, grid)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, grid) {
    const q = [[0, 0, 0]]
    let count = q.length
    const map = {}
    while (count) {
        while (count--) {
            const [x, y, c] = q.shift()
            const add = grid[x][y] === '.' ? 0 : 1
            if (x === n - 1 && y === m - 1) {
                map[c + add] = (map[c + add] || 0) + 1
            }
            // ans[x] = ans[x] || []
            // ans[x][y] = c
            if (x + 1 < n) q.push([x + 1, y, c + add])
            if (y + 1 < m) q.push([x, y + 1, c + add])
        }
        count = q.length
    }
    let ans
    let max
    for (let k in map) {
        k = +k
        if (!max || map[k] > ans || (map[k] === ans && k > max)) {
            max = k
            ans = map[k]
        }
    }
    // console.log(map)
    return max
}


const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, m] = lines[l++].trim().split(' ').map(Number)
        const grid = lines.slice(l, l + n).map(str => str.trim())
        l += n
        output[i] = solve(n, m, grid)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, grid) {
    let x = 0
    let y = 0
    let ans = grid[x][y] === '*' ? 1 : 0
    while (1) {
        [x, y] = bfs(n, m, grid, x, y)
        // console.log(x, y)
        if (grid[x][y] === '*') {
            ans++
        } else {
            break
        }
    }
    return ans
}
function bfs(n, m, grid, rx, ry,) {
    const q = [[rx, ry]]
    let count = q.length
    while (count) {
        while (count--) {
            const [x, y] = q.shift()
            if (grid[x][y] === '*' && !(x === rx && y === ry)) return [x, y]
            if (y + 1 < m) q.push([x, y + 1])
            if (x + 1 < n) q.push([x + 1, y])
        }
        count = q.length
    }
    return [n - 1, m - 1]
}


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));
const sub = (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 pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  const n = +readLine();
  let count = 0;

  for (let i = n; i >= 1; i--) {
    let [left, right] = [1, i - 1];
    const target = i * i;
    while (left < right) {
      const sum = left * left + right * right;
      if (sum === target) {
        count++;
        left++;
        right--;
      } else if (sum < target) left++;
      else right--;
    }
  }
  console.log(count);
}


var keyboard = 'qwertyuiopasdfghjkl;zxcvbnm,./';

var d = readline()
var str = readline();
var res = '';
for(var i=0;i<str.length;i++)
{
    var t = keyboard.indexOf(str[i]);
	if(d=='R')
	{
	    res+=keyboard[parseInt(t)-1];
	}
	else
	{
	    res+=keyboard[parseInt(t)+1];
	}
}
print(res);


var nums = readline().split(' ');
var a = parseInt(nums[0]);
var b = parseInt(nums[1]);
var MOD = 1000000007;

var x1,y1;
if(b%2==0)
{
    x1 = Mul(b/2,b-1);
}
else
{
    x1= Mul(b,(b-1)/2);
}
if(a%2==0)
{
    y1 = Mul(a/2,a+1);
}
else
{
    y1 = Mul(a,(a+1)/2);
}
var xx = (Mul(b,y1)+a)%MOD;
print(Mul(x1,xx));

function Mul(x,y)
{
    if(x>10000)
	{
	    var t1 = x%10000;
		var t2 = (x-t1)/10000;
		var tt1 = (y*t1)%MOD;
		var tt = (t2*y)%MOD;
		tt = (tt*10000)%MOD;
		return (tt+tt1)%MOD;
	}
	else
	{
	    return (x*y)%MOD;
	}
}


'use strict'

let ns = readline().split(' ').map(v => parseInt(v))
let ops = readline().split(' ')
let res = []

function aop (op, a, b) {
  if (op == '+') return a + b
  if (op == '*') return a * b
}

for (let i = 0; i < 4; i++) {
  for (let j = i; j < 3; j++) {
    for (let k = 0; k < 3; k++) {
      for (let t = k; t < 2; t++) {
        let cns = ns.map(v => v)
        let a = cns.splice(i, 1)[0]
        let b = cns.splice(j, 1)[0]
        let x = aop(ops[0], a, b)
        cns.push(x)
        let c = cns.splice(k, 1)[0]
        let d = cns.splice(t, 1)[0]
        let y = aop(ops[1], c, d)
        cns.push(y)
        let z = aop(ops[2], cns[0], cns[1])
        res.push(z)
      }
    }
  }
}

print(res.reduce((m, v) => Math.min(m, v)))


var readline = (()=>{
    process.stdin.resume();
    process.stdin.setEncoding('utf-8');

    let inputString = '';
    let currentLine = 0;

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

    process.stdin.on('end', _ => {
        inputString = inputString.trim().split('\n').map(string => {
            return string.trim();
        });

        main();
    });

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

function main() {
	return readline().match(/(.)\1*/g).filter(str=>str.length%2===0).length;

}


var readline = (()=>{
    process.stdin.resume();
    process.stdin.setEncoding('utf-8');

    let inputString = '';
    let currentLine = 0;

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

    process.stdin.on('end', _ => {
        inputString = inputString.trim().split('\n').map(string => {
            return string.trim();
        });

        main();
    });

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

function main() {
	console.log(readline().match(/(.)\1*/g).filter(str=>str.length%2===0).length);

}


'use strict'

const gcd = (x, y) => { while(y) y = x % (x = y); return x; }

const prime_factors = n => {
    if (n === 1) return [ 1 ];
    let i = 2;
    const factors = [];
    while (i * i <= n) {
        if (n % i) i += 1;
        else {
            while (n % i === 0) n /= i;
            factors.push(i);
        }
    }
    if (n > 1) factors.push(n);
    return factors;
}

const factors = prime_factors(+readline());
print(factors.slice(1).reduce((r, i) => gcd(r, i), factors[0]));


'use strict'

const gcd = (x, y) => { while(y) y = x % (x = y); return x; }

const prime_factors = n => {
    let i = 2;
    const factors = [];
    while (i * i <= n) {
        if (n % i) i += 1;
        else {
            while (n % i === 0) n /= i;
            factors.push(i);
        }
    }
    if (n > 1) factors.push(n)
    return factors;
}

const factors = prime_factors(+readline());
print(factors.slice(1).reduce((r, i) => gcd(r, i), factors[0]))


// var arr = readline().split(' ');
// var a = parseInt(arr[0]);
// var b = parseInt(arr[1]);
// var h = parseInt(arr[2]);
// var w = parseInt(arr[3]);
// var n = parseInt(arr[4]);
var v = [];
var h = [0,0,0,0];
for (var i = 0; i < 4; i ++)
{
    var arr = readline().split(' ');
    var l = [];
    for (var j = 0; j < 3; j ++)
    {
        if (parseInt(arr[j]) == 1)
        {
            h[ i ] = 1;
            h[ (i+3-j)%4 ] = 1;
        }
    }
    v.push(parseInt(arr[3]));
}
var ret = false;
for (var i = 0; i < 4; i ++)
{
    if (v[i]*h[i] == 1)
    {
        ret = true;
    }
}
print(ret?"YES":"NO");
// v.sort(function(a,b){return b-a;});


var l = [];
var s = [];
var r = [];
var p = [];

for(var i= 0; i < 4;i++){
	var numbers = readline().split(" ").map(function(x){ return parseInt(x)});
	l.push(numbers[0]);
	s.push(numbers[1]);
	r.push(numbers[2]);
	p.push(numbers[3]);
}
var result = false;
for(var i =0; i < 4;i++){
	if(p[i] == 1){
		if(l[i] == 1 || s[i] == 1 || r[i] == 1){
			result = true;
		}
	}
}
if(!result){
	for(var i =0; i < 4;i++){
		if(p[i] == 1){
			if(l[(i+1)%4] == 1 || s[(i+2)%4] == 1 || r[(i+3)%4] == 1)
				result = true;
		}
	}
}
if(result)
	print("YES");
else print("NO");


'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const N = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H']
  let [a, b, c] = ipt.split(EOL)[0].split(' ').map(n => N.indexOf(n)).sort((a, b) => a - b)
  if (
       12 - c + a == 3 && b - a == 4
    || b - a == 3 && c - b == 4
    || c - b == 3 && 12 - c + a == 4
  ) console.log('minor')
  else if (
       12 - c + a == 4 && b - a == 3
    || b - a == 4 && c - b == 3
    || c - b == 4 && 12 - c + a == 3
  ) console.log('major')
  else console.log('strange')
})


        var n;
        var dp = new Array(120);
        for(var i = 0; i < 120; i++){
            dp[i] = [-1, -1, -1];
        }

        function solve (arr, ind, last){
            if(ind === n){
                return 0;
            }

            if(dp[ind][last] != -1){
                return dp[ind][last];
            }
            var mn = 100000;
            mn = Math.min(mn, solve(arr, ind+1, 0)+1);
            if((arr[ind] == 1 || arr[ind] == 3) && last != 1){
                mn = Math.min(mn, solve(arr, ind+1, 1));
            }
            if((arr[ind] == 2 || arr[ind] == 3) && last != 2){
                mn = Math.min(mn, solve(arr, ind+1, 2));
            }

            //print(ind, last);
            //print("hi0: ",dp[1][1]);
            dp[ind][last] = mn;
            //print("hi1: ",dp[1][1]);

            return mn;
        }

        n = Number(readline());
        var arr = readline().split(' ').map(Number);
        print(solve(arr, 0, 0));


const input = readline();
const arr = Array.from(input, c => "AEFHIKLMNTVWXYZ".includes(c));
print(arr.every(x => x) || arr.every(x => !x) ? "YES" : "NO");


var input = readline();

function foo(str) {

    var aToZAscii = {};
    var aToZ = 'abcdefghijklmnopqrstuvwxyz';
    for (var data of aToZ) {
        aToZAscii[data] = {
            code: data.charCodeAt(0),
            mark: false
        };
    }

    var strAscii = []

    for (var data of str) {
        strAscii.push(data.charCodeAt(0));
    }

    var startJ = 0;
    for (var alphabets in aToZAscii) {

        for (var j = startJ; j < strAscii.length; j++) {
            if (aToZAscii[alphabets].code >= strAscii[j]) {
                aToZAscii[alphabets].mark = true;
                startJ = j + 1;
                break;
            }
        }
    }

    var everyMarked = true;
    for (var alpha in aToZAscii) {
        if (!aToZAscii[alpha].mark) {
            everyMarked = false;
            break;
        }
    }

    //console.log(everyMarked ? aToZ : -1);
    print(everyMarked ? aToZ : -1)
}

//foo('aacceeggiikkmmooqqssuuwwyy')
//foo('thereisnoanswer')
foo(input);


var input = readline();

function foo(str) {

    var aToZAscii = {};
    var aToZ = 'abcdefghijklmnopqrstuvwxyz';
    for (var data of aToZ) {
        aToZAscii[data] = {
            code: data.charCodeAt(0),
            mark: false
        };
    }

    var strAscii = []

    for (var data of str) {
        strAscii.push(data.charCodeAt(0));
    }

    var startJ = 0;
    for (var alphabets in aToZAscii) {

        for (var j = startJ; j < strAscii.length; j++) {
            if (aToZAscii[alphabets].code >= strAscii[j]) {
                strAscii[j] = aToZAscii[alphabets].code;
                aToZAscii[alphabets].mark = true;
                startJ = j + 1;
                break;
            }
        }
    }

    var everyMarked = true;
    for (var alpha in aToZAscii) {
        if (!aToZAscii[alpha].mark) {
            everyMarked = false;
            break;
        }
    }

    var finalStr = '';
    if (everyMarked) {
        for (var data of strAscii) {
            finalStr += String.fromCharCode(data)
        }
    }
    //console.log(everyMarked ? finalStr : -1);
    print(everyMarked ? finalStr : -1)
}

//foo('aacceeggiikkmmooqqssuuwwyy')
//foo('thereisnoanswer')
foo(input);


(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var a1 = rdN();
    var a2 = rdN();
    var k1 = rdN();
    var k2 = rdN();
    var n = rdN();

    if (k1 > k2) {
        var buf = a1;
        a1 = a2;
        a2 = buf;
        var buf = k1;
        k1 = k2;
        k2 = buf;
    }

    var maxForTeam1 = a1*(k1-1);
    var maxForTeam2 = a2*(k2-1);
    var minRemove = Math.max(0, n - (maxForTeam1 + maxForTeam2));

    var maxRemoveTeam1 = Math.min(a1, Math.floor(n/k1));
    n -= maxRemoveTeam1*k1;
    var maxRemoveTeam2 = Math.min(a2, Math.floor(n/k2));
    var maxremove = maxRemoveTeam1 + maxRemoveTeam2;

    wr(minRemove, maxremove);
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();


var a1 = Number(readline());
var a2 = Number(readline());
var k1 = Number(readline());
var k2 = Number(readline());
if (k1 > k2) {
  var t = a1;
  a1 = a2;
  a2 = t;
  t = k1;
  k1 = k2;
  k2 = t;
}
const n = Number(readline());
const a = Math.min(Math.floor(n / k1), a1);
const b = Math.min(Math.floor(Math.max(n - a * k1, 0) / k2), a2);
print(`${Math.min(Math.max(n - (a1 * (k1 - 1) + a2 * (k2 - 1)), 0), a1 + a2)} ${a + b}`);


(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 line = read.arrNumber(' ');
    var n = line[0];
    var M = line[1];
    var t = read.arrNumber( ' ');

    var sum = 0;
    var res = '';
    for(var i = 0; i < n; i++) {
        sum += t[i];
        if(M >= sum) {
            res += '0 ';
        }
        else {
            var nj = sum - M;
            var newT = t.slice(0, i).sort((a,b) =>  b - a);

            var count = 0;
            while(nj > 0) {
                nj -= newT[count];
                count++;
            }

            res += count + ' ';
        }
    }
    print(res);
}());


var ln = readline().split(' ').map(e => +e);
var std = ln[0], TIME = ln[1];

var ln = readline().split(' ').map(e => +e);
var dp = Array(std);

dp[0] = ln[0];
for (var i=1; i<ln.length; i++) dp[i] = ln[i] + dp[i-1];
for (var i=0; i<ln.length; i++){
  var count = 0;
  if (dp[i] > TIME) {
    var sub = ln.slice(0, i).sort((a, b) => a - b);
    while (sub.length) {
      if (dp[i] > TIME) count ++, dp[i] -= sub.pop();
      else break;
    }
  }

  write(String(count) + ' ');
}


'use strict';

/*let input = `000B:00001`.split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}*/

//code

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];

var _readline$split = readline().split(':');

var _readline$split2 = _slicedToArray(_readline$split, 2);

var hours = _readline$split2[0];
var min = _readline$split2[1];

var minRadix = [hours, min].join('').split('').reduce(function (acc, curr) {
	if (digits.indexOf(curr) > acc) {
		return digits.indexOf(curr);
	} else {
		return acc;
	}
}, 0);
minRadix++;
var radix = minRadix,
    infinite = false,
    lastRadixVal = void 0;
while (true) {
	/*
 let hoursVal = hours.split('').reduce((acc, curr) => {
 return acc*radix + digits.indexOf(curr);
 }, 0);*/

	var _map = [hours, min].map(function (time) {
		return time.split('').reduce(function (acc, curr) {
			return acc * radix + digits.indexOf(curr);
		}, 0);
	});

	var _map2 = _slicedToArray(_map, 2);

	var hoursVal = _map2[0];
	var minVal = _map2[1];

	if (hoursVal >= 24 || minVal >= 60) {
		break;
	}
	if (lastRadixVal && lastRadixVal === hoursVal * 60 + minVal) {
		infinite = true;
		break;
	}
	lastRadixVal = hoursVal * 60 + minVal;
	radix++;
}
var maxRadix = radix;
if (minRadix === maxRadix) {
	print("0");
} else if (infinite) {
	print("-1");
} else {
	var result = [];
	for (var i = minRadix; i < maxRadix; i++) {
		result.push(i);
	}
	print(result.join(' '));
}


'use strict';

/*let input = `00000:00000`.split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}*/

//code

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];

var _readline$split = readline().split(':');

var _readline$split2 = _slicedToArray(_readline$split, 2);

var hours = _readline$split2[0];
var min = _readline$split2[1];

var minRadix = [hours, min].join('').split('').reduce(function (acc, curr) {
	if (digits.indexOf(curr) > acc) {
		return digits.indexOf(curr);
	} else {
		return acc;
	}
}, 0);
minRadix++;
var radix = minRadix,
    infinite = false,
    lastRadixVal = void 0;
while (true) {
	/*
 let hoursVal = hours.split('').reduce((acc, curr) => {
 return acc*radix + digits.indexOf(curr);
 }, 0);*/

	var _map = [hours, min].map(function (time) {
		return time.split('').reduce(function (acc, curr) {
			return acc * radix + digits.indexOf(curr);
		}, 0);
	});

	var _map2 = _slicedToArray(_map, 2);

	var hoursVal = _map2[0];
	var minVal = _map2[1];

	if (hoursVal >= 24 || minVal >= 60) {
		break;
	}
	if (lastRadixVal !== undefined && lastRadixVal === hoursVal * 60 + minVal) {
		infinite = true;
		break;
	}
	lastRadixVal = hoursVal * 60 + minVal;
	radix++;
}
var maxRadix = radix;
if (minRadix === maxRadix) {
	print("0");
} else if (infinite) {
	print("-1");
} else {
	var result = [];
	for (var i = minRadix; i < maxRadix; i++) {
		result.push(i);
	}
	print(result.join(' '));
}


"use strict";var readline=require("readline"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return"function"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&"number"==typeof r.length}}();function isObject(r){return null!==r&&"object"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map((function(r,t){return t+1+") "+r.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;i<n.length;++i){n[i].remove(this)}if(isFunction(e))try{e.call(this)}catch(r){t=r instanceof UnsubscriptionError?flattenUnsubscriptionErrors(r.errors):[r]}if(isArray(o)){i=-1;for(var s=o.length;++i<s;){var u=o[i];if(isObject(u))try{u.unsubscribe()}catch(r){t=t||[],r instanceof UnsubscriptionError?t=t.concat(flattenUnsubscriptionErrors(r.errors)):t.push(r)}}}if(t)throw new UnsubscriptionError(t)}},r.prototype.add=function(t){var n=t;if(!t)return r.EMPTY;switch(typeof t){case"function":n=new r(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof r)){var e=n;(n=new r)._subscriptions=[e]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof r){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},r.prototype.remove=function(r){var t=this._subscriptions;if(t){var n=t.indexOf(r);-1!==n&&t.splice(n,1)}},r.EMPTY=function(r){return r.closed=!0,r}(new r),r}();function flattenUnsubscriptionErrors(r){return r.reduce((function(r,t){return r.concat(t instanceof UnsubscriptionError?t.errors:t)}),[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(r){function t(n,e,o){var i=r.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=empty;break;case 1:if(!n){i.destination=empty;break}if("object"==typeof n){n instanceof t?(i.syncErrorThrowable=n.syncErrorThrowable,i.destination=n,n.add(i)):(i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n));break}default:i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n,e,o)}return i}return __extends(t,r),t.prototype[rxSubscriber]=function(){return this},t.create=function(r,n,e){var o=new t(r,n,e);return o.syncErrorThrowable=!1,o},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this))},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){this.destination.error(r),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var r=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=r,this},t}(Subscription),SafeSubscriber=function(r){function t(t,n,e,o){var i,s=r.call(this)||this;s._parentSubscriber=t;var u=s;return isFunction(n)?i=n:n&&(i=n.next,e=n.error,o=n.complete,n!==empty&&(isFunction((u=Object.create(n)).unsubscribe)&&s.add(u.unsubscribe.bind(u)),u.unsubscribe=s.unsubscribe.bind(s))),s._context=u,s._next=i,s._error=e,s._complete=o,s}return __extends(t,r),t.prototype.next=function(r){if(!this.isStopped&&this._next){var t=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,r)&&this.unsubscribe():this.__tryOrUnsub(this._next,r)}},t.prototype.error=function(r){if(!this.isStopped){var t=this._parentSubscriber,n=config.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,r),this.unsubscribe()):(this.__tryOrUnsub(this._error,r),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=r,t.syncErrorThrown=!0):hostReportError(r),this.unsubscribe();else{if(this.unsubscribe(),n)throw r;hostReportError(r)}}},t.prototype.complete=function(){var r=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return r._complete.call(r._context)};config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(r,t){try{r.call(this._context,t)}catch(r){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)}},t.prototype.__tryOrSetError=function(r,t,n){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return config.useDeprecatedSynchronousErrorHandling?(r.syncErrorValue=t,r.syncErrorThrown=!0,!0):(hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var r=this._parentSubscriber;this._context=null,this._parentSubscriber=null,r.unsubscribe()},t}(Subscriber);function canReportError(r){for(;r;){var t=r,n=t.closed,e=t.destination,o=t.isStopped;if(n||o)return!1;r=e&&e instanceof Subscriber?e:null}return!0}function toSubscriber(r,t,n){if(r){if(r instanceof Subscriber)return r;if(r[rxSubscriber])return r[rxSubscriber]()}return r||t||n?new Subscriber(r,t,n):new Subscriber(empty)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function noop(){}function pipeFromArray(r){return r?1===r.length?r[0]:function(t){return r.reduce((function(r,t){return t(r)}),t)}:noop}var Observable=function(){function r(r){this._isScalar=!1,r&&(this._subscribe=r)}return r.prototype.lift=function(t){var n=new r;return n.source=this,n.operator=t,n},r.prototype.subscribe=function(r,t,n){var e=this.operator,o=toSubscriber(r,t,n);if(e?o.add(e.call(o,this.source)):o.add(this.source||config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},r.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){config.useDeprecatedSynchronousErrorHandling&&(r.syncErrorThrown=!0,r.syncErrorValue=t),canReportError(r)?r.error(t):console.warn(t)}},r.prototype.forEach=function(r,t){var n=this;return new(t=getPromiseCtor(t))((function(t,e){var o;o=n.subscribe((function(t){try{r(t)}catch(r){e(r),o&&o.unsubscribe()}}),e,t)}))},r.prototype._subscribe=function(r){var t=this.source;return t&&t.subscribe(r)},r.prototype[observable]=function(){return this},r.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 0===r.length?this:pipeFromArray(r)(this)},r.prototype.toPromise=function(r){var t=this;return new(r=getPromiseCtor(r))((function(r,n){var e;t.subscribe((function(r){return e=r}),(function(r){return n(r)}),(function(){return r(e)}))}))},r.create=function(t){return new r(t)},r}();function getPromiseCtor(r){if(r||(r=Promise),!r)throw new Error("no Promise impl found");return r}var EMPTY=new Observable((function(r){return r.complete()}));function empty$1(r){return r?emptyScheduled(r):EMPTY}function emptyScheduled(r){return new Observable((function(t){return r.schedule((function(){return t.complete()}))}))}var ArgumentOutOfRangeErrorImpl=function(){function r(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return r.prototype=Object.create(Error.prototype),r}(),ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl;function map(r,t){return function(n){if("function"!=typeof r)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new MapOperator(r,t))}}var MapOperator=function(){function r(r,t){this.project=r,this.thisArg=t}return r.prototype.call=function(r,t){return t.subscribe(new MapSubscriber(r,this.project,this.thisArg))},r}(),MapSubscriber=function(r){function t(t,n,e){var o=r.call(this,t)||this;return o.project=n,o.count=0,o.thisArg=e||o,o}return __extends(t,r),t.prototype._next=function(r){var t;try{t=this.project.call(this.thisArg,r,this.count++)}catch(r){return void this.destination.error(r)}this.destination.next(t)},t}(Subscriber);function readStdin(){var r=readline.createInterface(process.stdin);return new Observable((function(t){return r.on("line",(function(r){return t.next(r)})),function(){return r.close()}}))}function take(r){return function(t){return 0===r?empty$1():t.lift(new TakeOperator(r))}}var TakeOperator=function(){function r(r){if(this.total=r,this.total<0)throw new ArgumentOutOfRangeError}return r.prototype.call=function(r,t){return t.subscribe(new TakeSubscriber(r,this.total))},r}(),TakeSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){var t=this.total,n=++this.count;n<=t&&(this.destination.next(r),n===t&&(this.destination.complete(),this.unsubscribe()))},t}(Subscriber);function skip(r){return function(t){return t.lift(new SkipOperator(r))}}var SkipOperator=function(){function r(r){this.total=r}return r.prototype.call=function(r,t){return t.subscribe(new SkipSubscriber(r,this.total))},r}(),SkipSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){++this.count>this.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(" ").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i<r.length;i++)if(0===r[i]){for(var s=0===i?"any":r[i-1]%2==0?"even":"odd",u=i;i<r.length&&0===r[i];)i++;var c=--i===r.length-1?"any":r[i+1]%2==0?"even":"odd",a=i-u+1;o.push({left:s,right:c,distance:a})}else r[i]%2==0?n++:t++,i>0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),b=Math.floor(r.length/2),h=p-t,f=b-n,l=function(r,t){"any"===r?e+=1===t?0:1:"even"===r?f>=t?f-=t:e+=1:h>=t?h-=t:e+=1};o.sort((function(r,t){return t.distance-r.distance})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;"even"===t&&"odd"===n||"odd"===t&&"even"===n?e+=1:"any"===t?l(n,o):"any"===n?l(t,o):"even"===t?(f-=o)<0&&(e+=2):"odd"===t&&(h-=o)<0&&(e+=2)})),console.log(e)}));


"use strict";var readline=require("readline"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return"function"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&"number"==typeof r.length}}();function isObject(r){return null!==r&&"object"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map((function(r,t){return t+1+") "+r.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;i<n.length;++i){n[i].remove(this)}if(isFunction(e))try{e.call(this)}catch(r){t=r instanceof UnsubscriptionError?flattenUnsubscriptionErrors(r.errors):[r]}if(isArray(o)){i=-1;for(var s=o.length;++i<s;){var u=o[i];if(isObject(u))try{u.unsubscribe()}catch(r){t=t||[],r instanceof UnsubscriptionError?t=t.concat(flattenUnsubscriptionErrors(r.errors)):t.push(r)}}}if(t)throw new UnsubscriptionError(t)}},r.prototype.add=function(t){var n=t;if(!t)return r.EMPTY;switch(typeof t){case"function":n=new r(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof r)){var e=n;(n=new r)._subscriptions=[e]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof r){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},r.prototype.remove=function(r){var t=this._subscriptions;if(t){var n=t.indexOf(r);-1!==n&&t.splice(n,1)}},r.EMPTY=function(r){return r.closed=!0,r}(new r),r}();function flattenUnsubscriptionErrors(r){return r.reduce((function(r,t){return r.concat(t instanceof UnsubscriptionError?t.errors:t)}),[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(r){function t(n,e,o){var i=r.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=empty;break;case 1:if(!n){i.destination=empty;break}if("object"==typeof n){n instanceof t?(i.syncErrorThrowable=n.syncErrorThrowable,i.destination=n,n.add(i)):(i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n));break}default:i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n,e,o)}return i}return __extends(t,r),t.prototype[rxSubscriber]=function(){return this},t.create=function(r,n,e){var o=new t(r,n,e);return o.syncErrorThrowable=!1,o},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this))},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){this.destination.error(r),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var r=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=r,this},t}(Subscription),SafeSubscriber=function(r){function t(t,n,e,o){var i,s=r.call(this)||this;s._parentSubscriber=t;var u=s;return isFunction(n)?i=n:n&&(i=n.next,e=n.error,o=n.complete,n!==empty&&(isFunction((u=Object.create(n)).unsubscribe)&&s.add(u.unsubscribe.bind(u)),u.unsubscribe=s.unsubscribe.bind(s))),s._context=u,s._next=i,s._error=e,s._complete=o,s}return __extends(t,r),t.prototype.next=function(r){if(!this.isStopped&&this._next){var t=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,r)&&this.unsubscribe():this.__tryOrUnsub(this._next,r)}},t.prototype.error=function(r){if(!this.isStopped){var t=this._parentSubscriber,n=config.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,r),this.unsubscribe()):(this.__tryOrUnsub(this._error,r),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=r,t.syncErrorThrown=!0):hostReportError(r),this.unsubscribe();else{if(this.unsubscribe(),n)throw r;hostReportError(r)}}},t.prototype.complete=function(){var r=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return r._complete.call(r._context)};config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(r,t){try{r.call(this._context,t)}catch(r){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)}},t.prototype.__tryOrSetError=function(r,t,n){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return config.useDeprecatedSynchronousErrorHandling?(r.syncErrorValue=t,r.syncErrorThrown=!0,!0):(hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var r=this._parentSubscriber;this._context=null,this._parentSubscriber=null,r.unsubscribe()},t}(Subscriber);function canReportError(r){for(;r;){var t=r,n=t.closed,e=t.destination,o=t.isStopped;if(n||o)return!1;r=e&&e instanceof Subscriber?e:null}return!0}function toSubscriber(r,t,n){if(r){if(r instanceof Subscriber)return r;if(r[rxSubscriber])return r[rxSubscriber]()}return r||t||n?new Subscriber(r,t,n):new Subscriber(empty)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function noop(){}function pipeFromArray(r){return r?1===r.length?r[0]:function(t){return r.reduce((function(r,t){return t(r)}),t)}:noop}var Observable=function(){function r(r){this._isScalar=!1,r&&(this._subscribe=r)}return r.prototype.lift=function(t){var n=new r;return n.source=this,n.operator=t,n},r.prototype.subscribe=function(r,t,n){var e=this.operator,o=toSubscriber(r,t,n);if(e?o.add(e.call(o,this.source)):o.add(this.source||config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},r.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){config.useDeprecatedSynchronousErrorHandling&&(r.syncErrorThrown=!0,r.syncErrorValue=t),canReportError(r)?r.error(t):console.warn(t)}},r.prototype.forEach=function(r,t){var n=this;return new(t=getPromiseCtor(t))((function(t,e){var o;o=n.subscribe((function(t){try{r(t)}catch(r){e(r),o&&o.unsubscribe()}}),e,t)}))},r.prototype._subscribe=function(r){var t=this.source;return t&&t.subscribe(r)},r.prototype[observable]=function(){return this},r.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 0===r.length?this:pipeFromArray(r)(this)},r.prototype.toPromise=function(r){var t=this;return new(r=getPromiseCtor(r))((function(r,n){var e;t.subscribe((function(r){return e=r}),(function(r){return n(r)}),(function(){return r(e)}))}))},r.create=function(t){return new r(t)},r}();function getPromiseCtor(r){if(r||(r=Promise),!r)throw new Error("no Promise impl found");return r}var EMPTY=new Observable((function(r){return r.complete()}));function empty$1(r){return r?emptyScheduled(r):EMPTY}function emptyScheduled(r){return new Observable((function(t){return r.schedule((function(){return t.complete()}))}))}var ArgumentOutOfRangeErrorImpl=function(){function r(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return r.prototype=Object.create(Error.prototype),r}(),ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl;function map(r,t){return function(n){if("function"!=typeof r)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new MapOperator(r,t))}}var MapOperator=function(){function r(r,t){this.project=r,this.thisArg=t}return r.prototype.call=function(r,t){return t.subscribe(new MapSubscriber(r,this.project,this.thisArg))},r}(),MapSubscriber=function(r){function t(t,n,e){var o=r.call(this,t)||this;return o.project=n,o.count=0,o.thisArg=e||o,o}return __extends(t,r),t.prototype._next=function(r){var t;try{t=this.project.call(this.thisArg,r,this.count++)}catch(r){return void this.destination.error(r)}this.destination.next(t)},t}(Subscriber);function readStdin(){var r=readline.createInterface(process.stdin);return new Observable((function(t){return r.on("line",(function(r){return t.next(r)})),function(){return r.close()}}))}function take(r){return function(t){return 0===r?empty$1():t.lift(new TakeOperator(r))}}var TakeOperator=function(){function r(r){if(this.total=r,this.total<0)throw new ArgumentOutOfRangeError}return r.prototype.call=function(r,t){return t.subscribe(new TakeSubscriber(r,this.total))},r}(),TakeSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){var t=this.total,n=++this.count;n<=t&&(this.destination.next(r),n===t&&(this.destination.complete(),this.unsubscribe()))},t}(Subscriber);function skip(r){return function(t){return t.lift(new SkipOperator(r))}}var SkipOperator=function(){function r(r){this.total=r}return r.prototype.call=function(r,t){return t.subscribe(new SkipSubscriber(r,this.total))},r}(),SkipSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){++this.count>this.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(" ").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i<r.length;i++)if(0===r[i]){for(var s=0===i?"any":r[i-1]%2==0?"even":"odd",u=i;i<r.length&&0===r[i];)i++;var c=--i===r.length-1?"any":r[i+1]%2==0?"even":"odd",a=i-u+1;o.push({left:s,right:c,distance:a})}else r[i]%2==0?n++:t++,i>0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),b=Math.floor(r.length/2),h=p-t,f=b-n,l=function(r,t){"any"===r?e+=1:"even"===r?f>=t?f-=t:e+=1:h>=t?h-=t:e+=1};o.sort((function(r,t){return t.distance-r.distance})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;"even"===t&&"odd"===n||"odd"===t&&"even"===n?e+=1:"any"===t?l(n,o):"any"===n?l(t,o):"even"===t?(f-=o)<0&&(e+=2):"odd"===t&&(h-=o)<0&&(e+=2)})),console.log(e)}));


"use strict";var readline=require("readline"),extendStatics=function(r,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n])})(r,t)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function __extends(r,t){function n(){this.constructor=r}extendStatics(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function isFunction(r){return"function"==typeof r}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(r){r&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=r},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(r){setTimeout((function(){throw r}),0)}var empty={closed:!0,next:function(r){},error:function(r){if(config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)},complete:function(){}},isArray=function(){return Array.isArray||function(r){return r&&"number"==typeof r.length}}();function isObject(r){return null!==r&&"object"==typeof r}var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map((function(r,t){return t+1+") "+r.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._unsubscribe=r)}return r.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this._parentOrParents,e=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof r)n.remove(this);else if(null!==n)for(var i=0;i<n.length;++i){n[i].remove(this)}if(isFunction(e))try{e.call(this)}catch(r){t=r instanceof UnsubscriptionError?flattenUnsubscriptionErrors(r.errors):[r]}if(isArray(o)){i=-1;for(var s=o.length;++i<s;){var u=o[i];if(isObject(u))try{u.unsubscribe()}catch(r){t=t||[],r instanceof UnsubscriptionError?t=t.concat(flattenUnsubscriptionErrors(r.errors)):t.push(r)}}}if(t)throw new UnsubscriptionError(t)}},r.prototype.add=function(t){var n=t;if(!t)return r.EMPTY;switch(typeof t){case"function":n=new r(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof r)){var e=n;(n=new r)._subscriptions=[e]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof r){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},r.prototype.remove=function(r){var t=this._subscriptions;if(t){var n=t.indexOf(r);-1!==n&&t.splice(n,1)}},r.EMPTY=function(r){return r.closed=!0,r}(new r),r}();function flattenUnsubscriptionErrors(r){return r.reduce((function(r,t){return r.concat(t instanceof UnsubscriptionError?t.errors:t)}),[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(r){function t(n,e,o){var i=r.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=empty;break;case 1:if(!n){i.destination=empty;break}if("object"==typeof n){n instanceof t?(i.syncErrorThrowable=n.syncErrorThrowable,i.destination=n,n.add(i)):(i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n));break}default:i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,n,e,o)}return i}return __extends(t,r),t.prototype[rxSubscriber]=function(){return this},t.create=function(r,n,e){var o=new t(r,n,e);return o.syncErrorThrowable=!1,o},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this))},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){this.destination.error(r),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var r=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=r,this},t}(Subscription),SafeSubscriber=function(r){function t(t,n,e,o){var i,s=r.call(this)||this;s._parentSubscriber=t;var u=s;return isFunction(n)?i=n:n&&(i=n.next,e=n.error,o=n.complete,n!==empty&&(isFunction((u=Object.create(n)).unsubscribe)&&s.add(u.unsubscribe.bind(u)),u.unsubscribe=s.unsubscribe.bind(s))),s._context=u,s._next=i,s._error=e,s._complete=o,s}return __extends(t,r),t.prototype.next=function(r){if(!this.isStopped&&this._next){var t=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,r)&&this.unsubscribe():this.__tryOrUnsub(this._next,r)}},t.prototype.error=function(r){if(!this.isStopped){var t=this._parentSubscriber,n=config.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,r),this.unsubscribe()):(this.__tryOrUnsub(this._error,r),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=r,t.syncErrorThrown=!0):hostReportError(r),this.unsubscribe();else{if(this.unsubscribe(),n)throw r;hostReportError(r)}}},t.prototype.complete=function(){var r=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return r._complete.call(r._context)};config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(r,t){try{r.call(this._context,t)}catch(r){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError(r)}},t.prototype.__tryOrSetError=function(r,t,n){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return config.useDeprecatedSynchronousErrorHandling?(r.syncErrorValue=t,r.syncErrorThrown=!0,!0):(hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var r=this._parentSubscriber;this._context=null,this._parentSubscriber=null,r.unsubscribe()},t}(Subscriber);function canReportError(r){for(;r;){var t=r,n=t.closed,e=t.destination,o=t.isStopped;if(n||o)return!1;r=e&&e instanceof Subscriber?e:null}return!0}function toSubscriber(r,t,n){if(r){if(r instanceof Subscriber)return r;if(r[rxSubscriber])return r[rxSubscriber]()}return r||t||n?new Subscriber(r,t,n):new Subscriber(empty)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function noop(){}function pipeFromArray(r){return r?1===r.length?r[0]:function(t){return r.reduce((function(r,t){return t(r)}),t)}:noop}var Observable=function(){function r(r){this._isScalar=!1,r&&(this._subscribe=r)}return r.prototype.lift=function(t){var n=new r;return n.source=this,n.operator=t,n},r.prototype.subscribe=function(r,t,n){var e=this.operator,o=toSubscriber(r,t,n);if(e?o.add(e.call(o,this.source)):o.add(this.source||config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},r.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){config.useDeprecatedSynchronousErrorHandling&&(r.syncErrorThrown=!0,r.syncErrorValue=t),canReportError(r)?r.error(t):console.warn(t)}},r.prototype.forEach=function(r,t){var n=this;return new(t=getPromiseCtor(t))((function(t,e){var o;o=n.subscribe((function(t){try{r(t)}catch(r){e(r),o&&o.unsubscribe()}}),e,t)}))},r.prototype._subscribe=function(r){var t=this.source;return t&&t.subscribe(r)},r.prototype[observable]=function(){return this},r.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return 0===r.length?this:pipeFromArray(r)(this)},r.prototype.toPromise=function(r){var t=this;return new(r=getPromiseCtor(r))((function(r,n){var e;t.subscribe((function(r){return e=r}),(function(r){return n(r)}),(function(){return r(e)}))}))},r.create=function(t){return new r(t)},r}();function getPromiseCtor(r){if(r||(r=Promise),!r)throw new Error("no Promise impl found");return r}var EMPTY=new Observable((function(r){return r.complete()}));function empty$1(r){return r?emptyScheduled(r):EMPTY}function emptyScheduled(r){return new Observable((function(t){return r.schedule((function(){return t.complete()}))}))}var ArgumentOutOfRangeErrorImpl=function(){function r(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return r.prototype=Object.create(Error.prototype),r}(),ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl;function map(r,t){return function(n){if("function"!=typeof r)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new MapOperator(r,t))}}var MapOperator=function(){function r(r,t){this.project=r,this.thisArg=t}return r.prototype.call=function(r,t){return t.subscribe(new MapSubscriber(r,this.project,this.thisArg))},r}(),MapSubscriber=function(r){function t(t,n,e){var o=r.call(this,t)||this;return o.project=n,o.count=0,o.thisArg=e||o,o}return __extends(t,r),t.prototype._next=function(r){var t;try{t=this.project.call(this.thisArg,r,this.count++)}catch(r){return void this.destination.error(r)}this.destination.next(t)},t}(Subscriber);function readStdin(){var r=readline.createInterface(process.stdin);return new Observable((function(t){return r.on("line",(function(r){return t.next(r)})),function(){return r.close()}}))}function take(r){return function(t){return 0===r?empty$1():t.lift(new TakeOperator(r))}}var TakeOperator=function(){function r(r){if(this.total=r,this.total<0)throw new ArgumentOutOfRangeError}return r.prototype.call=function(r,t){return t.subscribe(new TakeSubscriber(r,this.total))},r}(),TakeSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){var t=this.total,n=++this.count;n<=t&&(this.destination.next(r),n===t&&(this.destination.complete(),this.unsubscribe()))},t}(Subscriber);function skip(r){return function(t){return t.lift(new SkipOperator(r))}}var SkipOperator=function(){function r(r){this.total=r}return r.prototype.call=function(r,t){return t.subscribe(new SkipSubscriber(r,this.total))},r}(),SkipSubscriber=function(r){function t(t,n){var e=r.call(this,t)||this;return e.total=n,e.count=0,e}return __extends(t,r),t.prototype._next=function(r){++this.count>this.total&&this.destination.next(r)},t}(Subscriber);readStdin().pipe(skip(1),take(1),map((function(r){return r.split(" ").map((function(r){return+r}))}))).subscribe((function(r){for(var t=0,n=0,e=0,o=[],i=0;i<r.length;i++)if(0===r[i]){for(var s=0===i?"any":r[i-1]%2==0?"even":"odd",u=i;i<r.length&&0===r[i];)i++;var c=--i===r.length-1?"any":r[i+1]%2==0?"even":"odd",a=i-u+1;o.push({left:s,right:c,distance:a})}else r[i]%2==0?n++:t++,i>0&&r[i-1]>0&&r[i-1]%2!=r[i]%2&&(e+=1);var p=Math.round(r.length/2),h=Math.floor(r.length/2),b=p-t,f=h-n,l=function(r,t){"any"===r?e+=1===t?0:1:"even"===r?f>=t?f-=t:e+=1:b>=t?b-=t:e+=1},d=function(r){var t=r.left,n=r.right,e=r.distance;return"any"===t||"any"===n?e+1e4:e};o.sort((function(r,t){return d(r)-d(t)})).forEach((function(r){var t=r.left,n=r.right,o=r.distance;"even"===t&&"odd"===n||"odd"===t&&"even"===n?e+=1:"any"===t?l(n,o):"any"===n?l(t,o):"even"===t?f>=o?f-=o:e+=2:"odd"===t&&(b>=o?b-=o:e+=2)})),console.log(e)}));


const data = readline().split(" ").map(x => Number(x));
const n = data[0];
const price = data[1];
const buyers = new Array(n).fill().map(() => readline().length >= 8);
var count = 0;
var total = 0;
for (var i = n; i;) {
  count *= 2;
  if (buyers[--i]) count++;
  total += count;
}
print(total * 0.5 * price);


(function() {
	var isValidHexagon = function(a) {
		//Valid hexagon cannot have random sides.
		//Starting at (0, 0) in 2D space we must return to the same point when follow all the sides.
		var x = a[0] + a[1] / 2 - a[2] / 2 - a[3] - a[4] / 2 + a[5] / 2;
		var y = a[1] + a[2] - a[4] - a[5];
		return x === 0 && y === 0;
	};
	//Reading the values validation.
	var line = readline().trim();
	var a = line.split(/\s+/);
	a = a.map(function(item) {
		var n = parseInt(item);
		if(!isFinite(n) || n <= 0) {
			throw new Error('Invalid hexagon length: ' + n);
		}
		return n;
	});
	if(a.length !== 6) {
		throw new Error('Invalid hexagon sides count: ' + a.length);
	}
	//Hexagon validation.
	if(!isValidHexagon(a)) {
		throw new Error('The sides specified do not form valid hexagon: [' + a.join(', ') + ']');
	}
	//The magic: read the hexagon row by row.
	var b = [], r = [];
	//Calculation the first part, where sides of hexagon row are like this /   \
	b[0] = Math.min(a[1], a[5]);
	r[0] = (a[0] + b[0]) * (a[0] + b[0]) - a[0] * a[0];
	//Calculating the second (possibly missing) part of hexagon where the sides are like this /   / or this \   \
	b[1] = 2 * (a[0] + b[0]);
	b[2] = Math.max(a[1], a[5]) - b[0];
	//Finally calculate mirror image of the first part (same formula) where the sides are like the \    /
	r[1] = b[1] * b[2];
	b[3] = Math.min(a[2], a[4]);
	r[2] = (a[3] + b[3]) * (a[3] + b[3]) - a[3] * a[3];
	//Sum the triangles from the tree parts. Value only valid when hexagon is valid.
	print(r[0] + r[1] + r[2]);
})();


const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  let [x, y] = ipt.split(EOL).slice(0, -1)[0].split(' ').map(v => parseInt(v))
  for (let i = 0; ; i++) {
    if (i % 2) {
      if (y >= 22) {
        y -= 22
      } else if (y >= 12 && x >= 1) {
        x -= 1
        y -= 12
      } else if (y >= 2 && x >= 2) {
        x -= 2
        y -= 2
      } else {
        return console.log('Ciel')
      }
    } else {
      if (x >= 2 && y >= 2) {
        x -= 2
        y -= 2
      } else if (x == 1 && y >= 12) {
        x = 0
        y -= 12
      } else if (y >= 22) {
        y -= 22
      } else {
        return console.log('Hanako')
      }
    }
  }
})


'use strict'

let lll = readline().split(' ').map(v => parseInt(v))
let X = lll[0]
let Y = lll[1]

let r = Math.sqrt(X * X + Y * Y)

let r0 = r | 0
let even = !(r0 % 2)
let q
if (X > 0 && Y > 0) {q = 1}
if (X > 0 && Y < 0) {q = 2}
if (X < 0 && Y < 0) {q = 1}
if (X < 0 && Y > 0) {q = 2}

;(function () {
  if (r == r0 || X == 0 || Y == 0) return print('black')
  if (q == 1 && even || q == 2 && !even) return print('black')
  if (q == 1 && !even || q == 2 && even) return print('white')
})()