const fs = require('fs');
const readline = require('readline');
const rl = readline.createInterface({
input: fs.createReadStream('input.txt'),
terminal: false
});
let str = '', prev;
rl.once('line', () => {
rl.on('line', line => {
if (line != prev) str += `${prev = line}\n`;
if (str.length > 100) {
fs.appendFileSync('output.txt', str);
str = '';
}
}).on('close', () => fs.appendFileSync('output.txt', str));
});
class Operations {
constructor(v) {
this.v = v;
}
get plus() { return new Values(x => this.v + x); }
get minus() { return new Values(x => this.v - x); }
get times() { return new Values(x => this.v * x); }
get dividedBy() { return new Values(x => this.v / x); }
valueOf() { return this.v; }
}
class Values {
constructor(op = v => v) {
this.op = op;
['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'].forEach((p, v) => {
Object.defineProperty(this, p, {
get: function() { return new Operations(this.op(v)); }
});
});
}
}
const calc = new Values;
typeof Calc.one.plus.one // 'object'
Calc.one.plus.one + 1 // 3
Calc.one.two // undefined;
Calc.one.plus.plus // undefined
class Magic {
constructor() {
this.operators = {
parent: this,
get plus() {return this.parent.op = (a, b) => a + b, this.parent;},
get minus() {return this.parent.op = (a, b) => a - b, this.parent;},
get dividedBy() {return this.parent.op = (a, b) => a / b, this.parent;},
get times() {return this.parent.op = (a, b) => a * b, this.parent;}
}
this.op = undefined;
['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'].forEach((v, i) => Object.defineProperty(this, v, {
get() {return this.op ? this.queue(this.operators.valueOf(), i, this.op) : this.queue(i)}
}));
}
queue(x, y, fn) {
this.operators.valueOf = function() { return fn ? fn(x, y) : x; }
this.op = undefined;
return this.operators;
}
}
var Calc = new Magic;
if (usn6.is(':checked') || usn16.is(':checked') && sotr1_3.is(':checked') && docs1_100.is(':checked'))
usn6.is(':checked') || ((usn16.is(':checked') && sotr1_3.is(':checked')) && docs1_100.is(':checked'))