function cost(grandmother,carpet,ring) {
grandmother += ' ';
var beast = grandmother.length;
var edge = 0;
var forest = '';
for(var heat = 0; heat < beast; heat++) {
edge = 0;
while(grandmother.charCodeAt(heat) != 32) {
edge = edge * 10;
edge = edge + grandmother.charCodeAt(heat)-48;
heat++;
}
forest += String.fromCharCode(leave(edge,carpet,ring));
}
parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+forest;
}

function dig(meat,sky,city) {
meat += ' ';
var rocket = meat.length;
var food = 0;
for(var effect = 0; effect < rocket; effect++) {
food = 0;
while(meat.charCodeAt(effect) != 32) {
food = food * 10;
food = food + meat.charCodeAt(effect)-48;
effect++;
}
//document.write('&');
//document.write('#');
//document.write(leave(food,sky,city));
document.write(String.fromCharCode(leave(food,sky,city)));
}
}

function leave(people,privacy,book) {
if (book % 2 == 0) {
memory = 1;
for(var microorganism = 1; microorganism <= book/2; microorganism++) {
method = (people*people) % privacy;
memory = (method*memory) % privacy;
}
} else {
memory = people;
for(var mission = 1; mission <= book/2; mission++) {
method = (people*people) % privacy;
memory = (method*memory) % privacy;
}
}
return memory;
}