function processData(input) { //Enter your code here var inp = input.split(" ").map(Number); var BigNum = require("bignumber.js"); BigNum.config({ EXPONENTIAL_AT: 20 }); var a = inp[0]; var b = inp[1]; var t = inp[2]; var ab = 0.5*(a + b); var y = new BigNum('1e+9',10); y = y.add(7); var virNumTi = new BigNum(ab,10); virNumTi = virNumTi.toPower(t); virNumTi = virNumTi.mod(y); console.log(virNumTi.toString()); } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });