creating sequential numbers from a single total count

creating numbers

Hello,

I have problems working out the following function. I made a small example in the attached excel sheet.
We have a specific software package that produces reports with only a total amount of counts per department, given in the last record per department (by simple example in the thirst two columns).

What I need R to do, is give me a third vector with sequential numbering as in the example.

Thanks

this ?

library(tidyverse)

ex1 <- tibble(dep=1:3,
              amount=c(10,5,6))

(ex2 <- uncount(ex1,weights = amount) |> 
  group_by(dep) |> 
  mutate(out=row_number()))