#include <iostream>
using namespace std;
const int maxN = 100224;
struct BIT {
int data[maxN];
void update(int idx, int val) {
while (idx < maxN) {
data[idx] += val;
idx += idx & -idx;
}
}
void update(int l, int r, int val) {
update(l, val);
update(r + 1, -val);
}
int query(int idx) {
int res = 0;
while (idx > 0) {
res += data[idx];
idx -= idx & -idx;
}
return res;
}
int query(int l, int r) {
return query(r) - query(l);
}
};
struct LazyBIT {
BIT bitAdd, bitSub;
void update(int l, int r, int val) {
bitAdd.update(l, r, val);
bitSub.update(l, r, (l - 1) * val);
bitSub.update(r + 1, (-r + l - 1) * val);
}
int query(int idx) {
return idx * bitAdd.query(idx) - bitSub.query(idx);
}
int query(int l, int r) {
return query(r) - query(l - 1);
}
};
int main() {
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IG1heE4gPSAxMDAyMjQ7CgpzdHJ1Y3QgQklUIHsKICAgIGludCBkYXRhW21heE5dOwogICAgdm9pZCB1cGRhdGUoaW50IGlkeCwgaW50IHZhbCkgewogICAgICAgIHdoaWxlIChpZHggPCBtYXhOKSB7CiAgICAgICAgICAgIGRhdGFbaWR4XSArPSB2YWw7CiAgICAgICAgICAgIGlkeCArPSBpZHggJiAtaWR4OwogICAgICAgIH0KICAgIH0KICAgIHZvaWQgdXBkYXRlKGludCBsLCBpbnQgciwgaW50IHZhbCkgewogICAgICAgIHVwZGF0ZShsLCB2YWwpOwogICAgICAgIHVwZGF0ZShyICsgMSwgLXZhbCk7CiAgICB9CiAgICBpbnQgcXVlcnkoaW50IGlkeCkgewogICAgICAgIGludCByZXMgPSAwOwogICAgICAgIHdoaWxlIChpZHggPiAwKSB7CiAgICAgICAgICAgIHJlcyArPSBkYXRhW2lkeF07CiAgICAgICAgICAgIGlkeCAtPSBpZHggJiAtaWR4OwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgfQogICAgaW50IHF1ZXJ5KGludCBsLCBpbnQgcikgewogICAgICAgIHJldHVybiBxdWVyeShyKSAtIHF1ZXJ5KGwpOwogICAgfQp9OwoKc3RydWN0IExhenlCSVQgewogICAgQklUIGJpdEFkZCwgYml0U3ViOwogICAgdm9pZCB1cGRhdGUoaW50IGwsIGludCByLCBpbnQgdmFsKSB7CiAgICAgICAgYml0QWRkLnVwZGF0ZShsLCByLCB2YWwpOwogICAgICAgIGJpdFN1Yi51cGRhdGUobCwgciwgKGwgLSAxKSAqIHZhbCk7CiAgICAgICAgYml0U3ViLnVwZGF0ZShyICsgMSwgKC1yICsgbCAtIDEpICogdmFsKTsKICAgIH0KICAgIGludCBxdWVyeShpbnQgaWR4KSB7CiAgICAgICAgcmV0dXJuIGlkeCAqIGJpdEFkZC5xdWVyeShpZHgpIC0gYml0U3ViLnF1ZXJ5KGlkeCk7CiAgICB9CiAgICBpbnQgcXVlcnkoaW50IGwsIGludCByKSB7CiAgICAgICAgcmV0dXJuIHF1ZXJ5KHIpIC0gcXVlcnkobCAtIDEpOwogICAgfQp9OwoKaW50IG1haW4oKSB7CiAgICByZXR1cm4gMDsKfQo=