Calculate the sum

I am not able to understand the question please help me to understand it.
1)In the first line will take the size of array
2)the second line will take the elements of array
3}what is happening in third line we have taken 2 then 1 then 0 please help me

in the 3rd line no of queries(q) is given
means how many times you have to solve the problem for different values of X
in next q lines
each line represent single integer X

and at end you have to print the sum of array elements

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.