#bzoj4939. 掉进兔子洞

掉进兔子洞

Topic Background

I (or you who are reading this text) do not belong to this world

This is the boundary of the world

The meaning of the world must exist outside the world

Everything in the world exists as it exists, and occurs as it happens

There is no value in the world --- On the Philosophy of Logic

Our lover is just a name borrowed casually and a soap bubble blown out of imagination

Take the letter, you can make the fake play come true

I used to moan aimlessly and confide in love without any illness - now these wandering birds have a place to rest, you can see from the letter

Take it - since it's not from the bottom of your heart, your words sound particularly pleasant. Take it, let's do it this way ..

Sure enough... a good woman needs cigarettes, rooftops... and light clothes

One day, Mizuki saw a cloth doll fall from the sky

Her puppet, thrown to be accepted by the sky, has danced in the sky countless times and is now covered in bruises

Being accepted by the sky "is to search for the behavior of" returning to the sky "that began to circulate in this city at an unknown time

The puppet thrown out to be accepted by the sky flies in the air and eventually falls

That is the act of sending the girl who is already the world to the girl in the sky

Spanning across the Milky Way, the two stars known as Vega and Altair, or Vega and Altair, along with the constellation Cygnus at the top of the Northern Cross, form the Summer Triangle

It is called a sacred figure such as the Trinity

Only when the sacred figure shines in the sky, does the world meet the sky

I want to give it a try, the first and last prank

That is What?

There's nothing wrong, it's just that Jun Jian jumped in on his own initiative~

What's going on?

There's nothing wrong, it's just that Jun Jian jumped in on his own initiative~

But I saw it, was it the one who killed everyone?

There's nothing wrong, it's just that Jun Jian jumped in on his own initiative~

No, that thing didn't do anything, just ..

There's nothing wrong, it's just that Jun Jian jumped in on his own initiative~

Just What's going on ..

There's nothing wrong, it's just that Jun Jian jumped in on his own initiative~

I did hear the sound of skull fracture

But that's not the outside world

And it always comes from within oneself

Water classmates I occasionally think about this kind of thing ..

Where is the limit of the world ..

The world's At the end of the world, even further away ..

If there could be such a place ..

If only I could stand there Can I still watch the scenery at the end as usual? I have this idea ...

I naturally think about this kind of thing ... and then the decision seems a bit strange

Because that's the end of the world

It's the limit of the world

If I could see that The limits of the world Is it equivalent to my limit?

Because of the world seen from there What I see Isn't this my world?

The limits of the world ... will become my limit, right~

The world is what I see, touch, and feel

In that case, what exactly is the world

What is the difference between the world and me I have this idea

Really?

The difference between the world and me

It's the same

But perhaps others have the same feeling ..

Even you may think that the world is just you

And I think that's probably correct ..

Although I am not quite sure Perhaps you are also standing at the end of the world, watching it like me

So, you are just like the world

But, that's really strange ..

If the world were me Why can't I see the world you see?

You clearly exist in my world But I can't see the world you see

I have never seen the world you see before

That's like a parallel universe where the two don't intersect ..

Even if there are phenomena suggesting the existence of that thing But it is absolutely untouchable ..

I. I can't see the world you're in ..

But ..

Is that really true too?

Have I really never seen your world ..

Since everyone is equal to have their own world

So why did the world become one?

Why do so many worlds exist here?

The reason why the world has become one

I occasionally think about this kind of thing

So Only then can I fall in love with you

Title Description

You are playing galgame and suddenly realize that you are too exhausted today, so you want to write a data structure problem to practice:

A sequence aa with a length of nn.

There are mm inquiries, each asking for 33 intervals. Delete the numbers that appear simultaneously in each interval, and ask for the sum of the remaining numbers in the last three intervals. The inquiries are independent.

Note that deleting here refers to deleting one by one, not directly deleting all numbers equal to this value,

For example, if three intervals are [1,2,2,3,3,3],[1,2,2,3,3,3][1,2,2,3,3,3], [1,2,2,3,3,3], and [1,1,2,3,3][1,1,2,3,3], then 11, 11, 22, and 22are all thrown away together.

Input format

The first line consists of two numbers representing nn and mm.

The number of nn in the second line represents a[i]a [i].

Afterwards, in the mm rows, each row contains 66numbers l1l_1,r1r_1,l2l_2,r2r_2,l3l_3, r3r_3representing these three intervals.

Output format

For each inquiry, output a number representing the answer.

Example

5 2
1 2 2 3 3
1 2 2 3 3 4
1 5 1 5 1 5
30

Data scope and agreement

For data of 100100%, n,m105,1a[i]109n, m\le 10^5, 1\le a[i]\le 10^9