Pascal's triangle has the shape drawn below. The top cell holds 1, and every number except the two at the ends of a row is the sum of the number immediately above it on the left and the number immediately above it on the right. Both numbers at the ends of a row are 1.

Rows are numbered from the top starting at 1, and within a row the numbers are counted from the left starting at 1, so row R holds R numbers.
Consider the equilateral triangle whose top vertex is the C-th number of row R and whose side contains W numbers. Add up every number on the sides of that triangle and inside it. For example, when R is 3, C is 1 and W is 4, the shaded part of the picture above is that triangle, and the sum is 1+(1+3)+(1+4+6)+(1+5+10+10)=42.
Given R, C and W, write a program that computes this sum.