A special number

3

29 votes
Basic Programming, , C++
Problem

A number n is said to be special if the sum of its digits is divisible by 4.

For a given integer a, find a number n such that:

  • n is a special number
  • na
  • n is minimum possible

Input format

  • The first line contains an integer T denoting the number of test cases.
  • For each test case:
    • The first line contains an integer a.

Output format

For each test case, print a number n that satisfies the above conditions in a new line.

Constraints

1T1051a103

 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For first test case:

  • n = 435, sum of digits is 12 which is divisible by 4.

For second test case:

  • n = 103, sum of digits is 4 which is divisible by 4.

 

Editor Image

?