Arithmetic Progressions
Tag(s):

## Easy-Medium, Fácil-médio, 简单偏中

Problem
Editorial
Analytics

Fredo recently learnt about Arithmetic Progressions. Seeing his keen interest in the topic, his teacher gave him a task. Fredo is initially given two tables:
1.first : It consists of first terms of arithmetic progressions.
2.diff : It consists of numbers which can act as the difference between two elements in the arithmetic progression.

For every entry a in the first table, you have to find the smallest number d greater than a in the diff table and then print the $5^{th}$ term of the arithmetic progression whose first term is a and difference is d.

Both the tables have unique entries.

Table : first

Field Type
a int

Table: diff

Field Type
d int

Field Type
a int
d int
Term int

### Sample Input:

Sample first Table:

a
17
18
46
52
62

Sample diff Table:

d
22
32
47
53
63

### Sample Output:

a d Term
17 22 105
18 22 106
46 47 234
52 53 264
62 63 314
Time Limit: 5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: MySQL, PostgreSQL, MSSQL, Oracle_Db

## CODE EDITOR

Initializing Code Editor...