Convenience Store Zone
Time limit3sMemory limit1024 MB
Given rooms with rents and stores on a grid, find the minimum of (Manhattan distance to the nearest store) times rent over all rooms.
Problem
A student who commutes four hours a day round trip wants to find a room near a convenience store.
He chooses a room using only the monthly rent and the distance to the nearest convenience store. To find the room he likes most, he gives every room on the map a convenience score and picks the room with the lowest score. The score is calculated as follows.
Convenience score = (distance from the room to the nearest convenience store × monthly rent)
The map is a grid of cells. The cell in row and column is written as . When a room is at and a convenience store is at , the distance between them is .
What is the convenience score of the room he picked, the one with the lowest score?
Input
The first line contains the map size and , the number of rooms , and the number of convenience stores , separated by spaces.
The next lines each contain three integers , , , separated by spaces. These mean that the -th room is at and its monthly rent is .
The next lines each contain two integers , , separated by spaces. These mean that the -th convenience store is at .
All rooms and convenience stores are at different positions. A cell holds at most one room or one convenience store.
Output
Print the convenience score of the room he picked on the first line.
Constraints
- There is at least one room and at least one convenience store.
Hint

