public static void updateTree(int index, int a, int b, int i, int j, int value) {

        if (lazy[index] != 0) {
            tree[index] += (2 * lazy[index] * sum[index]) + ((b - a + 1) * (lazy[index] * lazy[index]));
            tree[index] %= MOD;
            sum[index] += lazy[index] * (b - a + 1);
            sum[index] %= MOD;
            if (a != b) {
                lazy[index * 2 + 1] += lazy[index];
                lazy[index * 2 + 2] += lazy[index];
            }
            lazy[index] = 0;
        }

        if (a > b || a > j || b < i)
            return;

        if (a >= i && b <= j) {
            tree[index] += (2 * value * sum[index]) + (b - a + 1) * (value * value);
            tree[index] %= MOD;
            sum[index] += value * (b - a + 1);
            sum[index] %= MOD;
            if (a != b) {
                lazy[index * 2 + 1] += value;
                lazy[index * 2 + 2] += value;
            }
            return;
        }

        updateTree(index * 2 + 1, a, (a + b) / 2, i, j, value);
        updateTree(index * 2 + 2, (a + b) / 2 + 1, b, i, j, value);
        sum[index] = sum[2 * index + 1] + sum[2 * index + 2];
        tree[index] = tree[2 * index + 1] + tree[2 * index + 2];

    }