I need to take standard input like below
3 60 120 30 100 25 30 10
Variable form for above
n W v1 w1 v2 w2 v3 w3 . . . . . . vn