Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EI2122Q1DSAF3 - Employees Wage

Given the list of check-in and check-out time of employees. Calculate the wage of the employees. By default, each employee earns X KVND per hour. However, there are M employees who have different hourly wage rates because of their performance.

Input

-      The first line contains four integers N - the number of employees, X, M, K – the number of check-in/check-out records (1 £ N £ 105).

-      The second line contains N integers which are the id of employees

-      Each line in the next M lines contains two integers a, b representing that employee who has id equals to a, earn b VN per hour.

-      Each line in the next K lines contains two integers representing a check-in/check-out record. The first integer is the id of the employee. The second integer is the time of check-in/check-out

All integers don’t not exceed 109

Output

For each employee in ascending order of id, output the id and the wage.

 Sample

Input

Output

3 40 1 6

1 2 3

1 60

1 4

2 4

1 5

1 6

2 8

1 11

1 360

2 160

3 0


Added by:Ha Minh Ngoc
Date:2021-12-20
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.