SHOPPING! SHOPPING! SHOPPING!

input :
First line = Your money
Second line = n = Many items you buy
Third line - n line = price of items

Output : the rest of the money you have

IN

2000
2
1000
100

OUT

900

IN

3000
2
1000
1000

OUT

1000

IN

20000
5
2000
3000
1000
1000
1000

OUT

12000

IN

20000
3
2000
1000
1000

OUT

16000

IN

10000
2
1000
1000

OUT

8000


Leave a comment

Parsed as Markdown

Login to leave a comment