How to train this neural network?
Let $w$ denote the weights of the neural network.  Define the objective function $\Psi$ by

$$\Psi(w) = \sum_i \left(\left(\sum_j NN_w(A_{ij},B_{ij},C_{ij})\right) - Q_i\right)^2.$$

Then, find $w$ that minimizes $\Psi(w)$ using gradient descent.  You can find the gradient of $\Psi(w)$ using backpropagation through the neural network.  You can use all the standard methods for speeding up training of neural networks: stochastic gradient descent, Adam or momentum or Adagrad, etc.

This is very similar to training neural networks for regression problems.  The only difference here is that you are summing the output of the neural network on multiple inputs.  It is straightforward to adjust the objective function to take that into account, as shown above.