title: Adding up Values of different Indexes automatically
body: <p>I have a list (a), which contains references to another list (b). I am trying to create a third list (c), which contains the summed up values of (b) referenced in the according index of (a). Below is an example to hopefully make it clearer.</p>
  
  <p>I have a rather large data set and this needs to be done frequently as part of an optimization process. Is there a way besides nested for-loops to do this efficiently and automated, without having to define every entry of c?</p>
  
  <pre><code>a = [[0],[0,3],[1,2],[3],[1,2,3]]
  b = [10,20,30,40]
  c = [b[0], b[0]+b[3], b[1]+b[2], b[3], b[1]+b[2]+b[3]]
  </code></pre>
  
  <p>Thanks in advance for any help, and sorry for potential mistakes in the post. It's my first and I'm trying to learn. </p>