I would like to generate a matrix of all combinations of 3 elements with a fixed element to get a given row sum value n. The result take this format for n=6 with fixed column V4 value equal to 1:
  V1  V2  V3  V4
   5   0   0   1
   0   5   0   1
   0   0   5   1
   4   1   0   1
   4   0   1   1
   3   2   0   1
   3   0   2   1
   2   3   1   1
   2   1   3   1
   1   2   2   1
   .   .   .   1
   .   .   .   1
   .   .   .   .
   .   .   .   .
Many thanks in advance!