I have a SQL table with data in the following format:

```
REF  FIRSTMONTH  NoMONTHS  VALUE
--------------------------------
1    2           1         100
2    4           2         240
3    5           4         200

```

This shows a quoted value which should be delivered starting on the FIRSTMONTH and split over NoMONTHS

I want to calculate the SUM for each month of the potential deliveries from the quoted values.
As such I need to return the following result from a SQL server query:

```
MONTH  TOTAL
------------
2      100   <- should be all of REF=1
4      120   <- should be half of REF=2
5      170   <- should be half of REF=2 and quarter of REF=3
6      50    <- should be quarter of REF=3
7      50    <- should be quarter of REF=3
8      50    <- should be quarter of REF=3

```

How can I do this?