# ALCATRAZ2 – GO GOA GONE Solution

0
4

## ALCATRAZ2 Statement

So , it was winter and Me and 8 of my friends decided to plan a trip to GOA . Since the Bars ans Clubs are too Expensive out there , we decided to pool money together for our whole trip expenses . Now since every group has some internal politics going on , same aplies to our group also đ . 2 Members that are having a cold war between them won’t go to the trip if the other one is going . But Since we want to enjoy a lavish party , we want to maximize the pooled money . So , for this task I’ve chosen my marwari friendÂ Mohit to solve this problem Â ( He’s good at money matters )Â  . Your task is to helpÂ Mohit achieve the maximum pooled moneyÂ .

### Input

First Line will containÂ  8 space seperated integers denoting the money contributed by each member in order .

The next line will contain the total number of pairs having a cold war in between them . Let us denote thisÂ by P .

The next P lines will contain 2 numbers seperated by a space showing the members having a cold warÂ  . Numbers used to denote members will be ( 1-8 ) for each 8 membersÂ .

Constraints:

Output description

Output will give the maximum amt of money that can be pooled .

## ALCATRAZ2 Solution

May you like to see

This site uses Akismet to reduce spam. Learn how your comment data is processed.