As everybody may know, Reza Shiri is our favorite artist. SBU students love his songs and they share them in their telegram groups all the time. In the Newbies 2018, the hardest problem of the contest was about Reza Shiri’s concert.
This year you are going to help us with purchasing Reza Shiri’s songs. Since we love Reza Shiri and his songs, we never download his songs for free. Reza Shiri’s songs must be purchased from the authorized stores.
Going to the iTunes store, each song can be purchased in one of the following ways:
Well, everybody wants to purchase all of the available songs and albums. Unfortunately, having a limited budget, one may not be able to afford buying all of the songs. There are songs and albums available. Each song belongs to exactly one Album. Songs are numbered from to . Albums are numbered from to .
The first line of input contains three space-separated integers and – denoting the number of songs, the number of albums, and our budget respectively. The description of songs is given in the following lines.
Each line consists of 2 space-separated integers and – indicating the album containing this song and the price of this song.
In the next line of each test, there are space separated integers – denoting the price of the albums.
Print the maximum number of songs that we can afford to buy.
In the first test case, it is the best to buy the first album and two songs from the second album.
In the second test case, it is the best to buy the first album and one song from the second album.
In the third test case, it is the best to buy the first and the second album.