Polycarp knows that if the sum of the digits of a number is divisible by $3$, then the number itself is divisible by $3$. He assumes that the numbers, the sum of the digits of which is divisible by $4$, are also somewhat interesting. Thus, he considers a positive integer $n$ interesting if its sum of digits is divisible by $4$.

Help Polycarp find the nearest larger or equal interesting number for the given number $a$. That is, find the interesting number $n$ such that $n \ge a$ and $n$ is minimal.


-----Input-----

The only line in the input contains an integer $a$ ($1 \le a \le 1000$).


-----Output-----

Print the nearest greater or equal interesting number for the given number $a$. In other words, print the interesting number $n$ such that $n \ge a$ and $n$ is minimal.


-----Examples-----
Input
432

Output
435

Input
99

Output
103

Input
237

Output
237

Input
42

Output
44

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
a = input()
x = int(a)
l = list(map(int, a))
s = sum(l)
while s % 4 != 0:
	x += 1
	l = map(int, str(x))
	s = sum(l)
print(x)


a = int(input())
c = a
out = 1
while out % 4 != 0:
	out = 0
	b = map(int, str(c))
	for x in b:
		out += x
	if out % 4 == 0:
		print(c)
		break
	else:
		out = 1
	c = int(c)
	c += 1


def sumdig(n):
	sum_ = 0
	n = str(n)
	for i in range(len(n)):
		sum_ += int(n[i])
	return sum_

def fun(n):
	sum_ = 0
	for i in range(len(n)):
		ans = 0
		sum_ += int(n[i])
	if sum_ % 4 == 0:
		ans = int(n)
	elif int(n) <= 4:
		ans = 4
	else:
		t = int(n)
		for i in range(10):
			s = sumdig(t)
			if s % 4 == 0:
				ans = t
				break
			t = t + 1
	return ans
n = input()
print(fun(n))


n = int(input())
while 1:
	s = 0
	temp = str(n)
	for x in temp:
		s += int(x)
	if s % 4 == 0:
		print(temp)
		break
	n += 1


import math
a = int(input())
b = a
while True:
	c = b
	c = str(c)
	total = 0
	for i in range(len(c)):
		total += int(c[i])
	if total % 4 == 0:
		print(b)
		break
	else:
		b += 1


def digitsum(x):
	return sum(map(int, str(a)))
a = int(input())
while digitsum(a) % 4 != 0:
	a += 1
print(a)


s = input()
a = 1
while a % 4 != 0:
	a = 0
	for i in range(0, len(s)):
		a += int(s[i])
	if a % 4 != 0:
		t = int(s)
		t = t + 1
		s = str(t)
print(s)


def divi(num):
	num = list(map(int, num))
	return sum(num) % 4 == 0
n = input()
p = int(n)
while not divi(n):
	p = p + 1
	n = str(p)
print(n)


n = int(input())

def isInteresting(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	return s % 4 == 0
while 1:
	if isInteresting(n):
		print(n)
		exit()
	else:
		n += 1


def mycount(string):
	sum = 0
	for ch in string:
		sum += int(ch)
	return sum
s = input()
while mycount(s) % 4 != 0:
	s = str(int(s) + 1)
print(int(s))


def is_interesting(x):
	digits = []
	while x > 0:
		digits.append(x % 10)
		x = int(x / 10)
	return sum(digits) % 4 == 0
input_string = input()
number = int(input_string)
while not is_interesting(number):
	number = number + 1
print(number)


n = int(input())
i = n
f = lambda x: sum(map(int, list(str(x))))
while f(i) % 4 != 0:
	i += 1
print(i)


def sum_of_digits(n):
	sum = 0
	while n > 0:
		sum += n % 10
		n //= 10
	return sum
n = int(input())
while sum_of_digits(n) % 4 != 0:
	n += 1
print(n)


a = int(input())
for i in range(a, 1000000000):
	x = 0
	for j in range(len(str(i))):
		x += int(str(i)[j])
	if x % 4 == 0:
		print(i)
		exit(0)


n = int(input())
f = 0
while f == 0:
	a = list(str(n))
	s = 0
	for i in range(len(a)):
		s = s + int(a[i])
	if s % 4 == 0:
		print(n)
		f = 1
	n = n + 1


def calc(x):
	result = 0
	while x != 0:
		result += x % 10
		x //= 10
	return result
inp = int(input())
res = calc(inp)
if res % 4 == 0:
	print(inp)
else:
	i = inp
	while calc(i) % 4 != 0:
		i += 1
	print(i)


import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(input())

def isInteresting(n):
	sumv = 0
	while not n == 0:
		sumv += n % 10
		n = n // 10
	if sumv % 4 == 0:
		return True
	return False
while not isInteresting(n):
	n += 1
print(n)


st = input()
sum = 0
ans = int(st)
for s in range(int(st), 200000):
	s = str(s)
	sum = 0
	for x in s:
		sum += int(x)
	if sum % 4 == 0:
		print(s)
		break


i = int(input())

def find(i):
	j = 0
	while True:
		if sum([int(x) for x in str(i + j)]) % 4 == 0:
			return i + j
		j += 1
print(find(i))


a = int(input())
while 1 > 0:
	b = str(a)
	c = 0
	for i in range(len(b)):
		c = c + int(b[i])
	if c % 4 == 0:
		print(a)
		break
	else:
		a = a + 1


n = input()
s = 0
for i in n:
	s += int(i)
a = 1
while s % 4 != 0:
	n = str(int(n) + a)
	s = 0
	for i in n:
		s += int(i)
print(n)


a = int(input())
b = a
s = 0
while b:
	s += b % 10
	b //= 10
k = (4 - s % 4) % 4
if a % 10 + k >= 10:
	a = (a + 9) // 10 * 10
b = a
s = 0
while b:
	s += b % 10
	b //= 10
k = (4 - s % 4) % 4
print(a + k)


def sumdig(n):
	s = 0
	n = str(n)
	for i in n:
		s = s + int(i)
	return s
n = int(input())
while sumdig(n) % 4 != 0:
	n += 1
print(n)


def isSumOfDigitsDivisible(a: int):
	n = a
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s % 4 == 0
a = int(input())
while not isSumOfDigitsDivisible(a):
	a += 1
print(a)


n = int(input())
while sum([int(i) for i in str(n)]) % 4 != 0:
	n += 1
print(n)


a = input()
s = 0
for i in a:
	s += int(i)
while 1:
	if s % 4 == 0:
		print(a)
		break
	else:
		a = int(a) + 1
		a = str(a)
		s = 0
		for i in a:
			s += int(i)


def sot(x):
	c = 0
	while x > 0:
		c += x % 10
		x //= 10
	return c
a = int(input())
while sot(a) % 4 != 0:
	a += 1
print(a)


a = int(input())
k = 1
while k % 4 != 0:
	if 1 <= a <= 9:
		if a % 4 == 0:
			k = a
	elif 10 <= a <= 99:
		k = a % 10 + a // 10
	elif 100 <= a <= 999:
		k = a % 100 // 10 + a % 10 + a // 100
	elif a == 1000:
		k = 4
		a = 1003
	a += 1
print(a - 1)


n = int(input())

def dsum(n):
	ans = 0
	while n > 0:
		ans += n % 10
		n //= 10
	return ans
while dsum(n) % 4 != 0:
	n += 1
print(n)


a = int(input())
while True:
	if sum(list(map(int, list(str(a))))) % 4 == 0:
		break
	a += 1
print(a)


def sum_of_digits(d: int) -> int:
	res = 0
	for i in str(d):
		res += int(i)
	return res

def finde_upper(n: int) -> int:
	for i in range(n, 4 * n + 1):
		if sum_of_digits(i) % 4 == 0:
			return i

def finde_lower(n: int) -> int:
	for i in reversed(range(1, 4 * n + 1)):
		if sum_of_digits(i) % 4 == 0:
			return i
n = int(input())
u = finde_upper(n)
l = finde_lower(n)
print(u if abs(n - u) <= abs(n - l) else l)


n = int(input())

def func(m):
	s = 0
	while m != 0:
		rem = m % 10
		s += rem
		m = m // 10
	if s % 4 == 0:
		return 1
	else:
		return 0
while func(n) == 0:
	n = n + 1
print(n)


def f(p):
	ans = 0
	while int(p) > 0:
		ans = ans + p % 10
		ans = int(ans)
		p = p / 10
	return int(ans)
n = int(input())
while n:
	if int(f(n)) % 4 == 0:
		print(n)
		exit(0)
	n = n + 1


def summ(n):
	s = 0
	for i in str(n):
		s += int(i)
	return s
n = int(input())
for i in range(n, n * 4 + 1):
	if summ(i) % 4 == 0:
		print(i)
		break


n = int(input())
while True:
	k = n
	sumi = 0
	while k:
		sumi += k % 10
		k //= 10
	if sumi % 4 == 0:
		print(n)
		break
	n += 1


n = input()
while True:
	s = 0
	for i in n:
		s += int(i)
	if s % 4 == 0:
		print(n)
		break
	n = str(int(n) + 1)


n = int(input())
while sum(map(int, str(n))) % 4:
	n = n + 1
print(n)


Number = int(input())
temp = Number
Sum = 0
while Number > 0:
	Reminder = Number % 10
	Sum = Sum + Reminder
	Number = Number // 10
while Sum % 4:
	temp += 1
	Number = temp
	Sum = 0
	while Number > 0:
		Reminder = Number % 10
		Sum = Sum + Reminder
		Number = Number // 10
print(temp)


a = str(input().strip())
add = 0
for i in a:
	add += int(i)
while add % 4 != 0:
	a = str(int(a) + 1)
	add = 0
	for i in a:
		add += int(i)
print(a)


n = int(input())
while True:
	a = sum([int(i) for i in list(str(n))])
	if a % 4 == 0:
		break
	n = n + 1
print(n)


def qw(n):
	r = 0
	while n:
		(r, n) = (r + n % 10, n // 10)
	return r
n = int(input())
while True:
	if qw(n) % 4 == 0:
		print(n)
		break
	n = n + 1


def dsum(n):
	s = 0
	while n:
		s += n % 10
		n = n // 10
	return s
a = int(input())
while int(dsum(a)) % 4 != 0:
	a += 1
print(a)


n = int(input())

def zbr(x):
	x = str(x)
	sol = 0
	for i in x:
		sol += int(i)
	if sol % 4 == 0:
		return True
	return False
while not zbr(n):
	n += 1
print(n)


from fractions import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())

def ketawa(n):
	ans = 0
	while n:
		ans += n % 10
		n //= 10
	return ans
n = I()
while True:
	a = ketawa(n)
	if a % 4 == 0:
		print(n)
		exit()
	n += 1


def sumofdigits(x):
	a = 0
	for i in range(len(x)):
		a += int(x[i])
	return a
n = input()
while sumofdigits(n) % 4 != 0:
	n = str(int(n) + 1)
print(n)


n = int(input())
while True:
	s = sum((int(ch) for ch in str(n)))
	if s % 4 == 0:
		break
	n += 1
print(n)


z = input()
total = 0
for i in range(len(z)):
	total += int(z[i])
status = True
while status:
	if total % 4 == 0:
		print(z)
		status = False
	else:
		total = 0
		z = int(z)
		z += 1
		z = str(z)
		for i in range(len(z)):
			total += int(z[i])


s = input()
sm = 0
length = len(s)
for i in range(len(s)):
	sm += int(s[i])
while sm % 4 != 0:
	a = int(s) + 1
	s = str(a)
	sm = 0
	for i in range(len(s)):
		sm += int(s[i])
print(s)


n = int(input())
a = n
while a >= n:
	s = 0
	b = a
	while b > 0:
		s = s + int(b % 10)
		b = b / 10
	if s % 4 == 0:
		print(a)
		break
	else:
		a = a + 1


t = int(input(''))
for i in range(9):
	if sum(list(map(int, list(str(t + i))))) % 4 == 0:
		print(t + i)
		break


def calcul_somme(a):
	i = 0
	for j in range(len(a)):
		i = i + int(a[j])
	return i
a = input()
while calcul_somme(a) % 4 != 0:
	a = str(int(a) + 1)
print(int(a))


def ma(a):
	b = 0
	while a != 0:
		b = b + a % 10
		a = a // 10
	return b
a = int(input())
done = False
while not done:
	if ma(a) % 4 == 0:
		print(a)
		done = True
	else:
		a = a + 1


def s(x):
	res = 0
	while x > 0:
		res += x % 10
		x //= 10
	return res
a = int(input())
while s(a) % 4 != 0:
	a += 1
print(a)


def sumofdigits(st):
	sum = 0
	for j in st:
		sum += int(j)
	return sum
n = input()
if sumofdigits(n) % 4 == 0:
	print(n)
else:
	num = int(n)
	for i in range(num + 1, 1000000):
		if sumofdigits(str(i)) % 4 == 0:
			print(i)
			break


from sys import stdin

def check(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	if s % 4 == 0:
		return True
	return False
n = int(stdin.readline().rstrip())
if check(n) == True:
	print(n)
else:
	while check(n) != True:
		n += 1
	print(n)


n = int(input())
a = list(str(n))
sum = 0
for i in a:
	sum += int(i)
if sum % 4 != 0:
	for i in range(10):
		n = n + 1
		b = list(str(n))
		k = 0
		for j in b:
			k += int(j)
		if k % 4 == 0:
			break
print(n)


n = int(input())
s = 0
while n > 0:
	n1 = n
	while n1 > 0:
		s += n1 % 10
		n1 = n1 // 10
	if s % 4 == 0:
		print(n)
		break
	n += 1
	s = 0


def isgood(n):
	s = 0
	for l in str(n):
		s += int(l)
	return s % 4 == 0
n = int(input())
while isgood(n) == False:
	n += 1
print(n)


t = input()
while 1:
	s = [int(i) for i in t]
	if sum(s) % 4 == 0:
		print(t)
		break
	t = str(int(t) + 1)


def res(n):
	s = 0
	for i in range(len(n)):
		s = s + int(n[i])
	m = (4 - s % 4) % 4
	return m
l = int(input())
for i in range(l, l + 10):
	n = str(i)
	if res(n) == 0:
		print(i)
		break


n = input()
s = sum(map(int, n))
while s % 4 != 0:
	n = str(int(n) + 1)
	s = sum(map(int, n))
print(n)


def checkSum(n):
	sm = 0
	for i in range(len(n)):
		sm += int(n[i])
	return sm
n = input()
while checkSum(n) % 4 != 0:
	n = str(int(n) + 1)
print(n)


def smn(x):
	sm = 0
	while x:
		sm += int(x % 10)
		x /= 10
	return sm
a = int(input())
while 1:
	if smn(a) % 4 == 0:
		print(a)
		break
	a += 1


n = int(input())

def dgsum(temp):
	ans = 0
	while temp > 0:
		r = temp % 10
		temp = temp // 10
		ans += r
	return ans
val = False
while not val:
	if dgsum(n) % 4 != 0:
		n += 1
	else:
		val = True
print(n)


x = str(input())
while True:
	c = 0
	for i in range(len(x)):
		c = c + int(x[i])
	if c % 4 == 0:
		print(x)
		break
	else:
		x = str(int(x) + 1)


a = int(input())
b = a
cnt = 0
while True:
	res = 0
	while b != 0:
		res += b % 10
		b = b // 10
	if res % 4 == 0:
		break
	cnt += 1
	b = a + cnt
print(a + cnt)


num = int(input())

def sumOfDigits(numbr):
	sum1 = 0
	while numbr != 0:
		sum1 += numbr % 10
		numbr = numbr // 10
	return sum1
while sumOfDigits(num) % 4 != 0:
	num += 1
print(num)


def chk(n):
	p = 0
	while n:
		p += n % 10
		n = int(n / 10)
	return p % 4 == 0
n = int(input())
while True:
	if chk(n):
		print(n)
		exit(0)
	else:
		n += 1


a = input()
c = int(a)
b = str(a)
for i in range(1000):
	l = list(map(int, b.strip()))
	if sum(l) % 4 == 0:
		print(b)
		break
	else:
		b = int(b)
		b = b + 1
		b = str(b)


a = int(input())
for i in range(a, 10 ** 19):
	if sum(map(int, list(str(i)))) % 4 == 0:
		print(i)
		exit(0)


def chk(n):
	s = str(n)
	c = 0
	for i in s:
		x = ord(i) - ord('0')
		c += x
	return c % 4 == 0
n = int(input())
for i in range(n, 10000):
	if chk(i):
		print(i)
		break


a = int(input())

def findSum(a):
	a = str(a)
	s = 0
	for i in range(len(a)):
		s = s + int(a[i])
	return s
while True:
	sumOfDigits = findSum(a)
	if sumOfDigits % 4 == 0:
		print(a)
		break
	else:
		a += 1


a = int(input())

def div(a):
	sum = 0
	while a > 0:
		sum += int(a % 10)
		a = a / 10
	if sum % 4 == 0:
		return False
	else:
		return True
while div(a):
	a += 1
print(a)


def solve():
	a = input()
	sm = sum((int(k) for k in a))
	while sm % 4 != 0:
		a = str(int(a) + 1)
		sm = sum((int(k) for k in a))
	print(a)
solve()


def div(n):
	n = str(n)
	xx = 0
	for i in range(len(n)):
		xx += int(n[i])
	return xx
n = int(input())
while div(n) % 4 != 0:
	n += 1
print(n)


def digitssum(n):
	n = str(n)
	return sum(map(int, list(n)))
n = input()
if digitssum(n) % 4 == 0:
	print(n)
else:
	while digitssum(n) % 4 != 0:
		n = int(n) + 1
	print(n)


def sumdig(n):
	s = 0
	while n != 0:
		s = s + n % 10
		n = n // 10
	return s
k = int(input())
while sumdig(k) % 4 != 0:
	k = k + 1
print(str(k))


n = int(input())
k = n

def fg(k):
	a = []
	while k != 0:
		a.append(k % 10)
		k = k // 10
	s = sum(a)
	return s
while fg(k) % 4 != 0:
	k = k + 1
print(k)


n = int(input())

def sum_of_no(n):
	l = list(str(n))
	return sum(map(int, l))
while sum_of_no(n) % 4 != 0:
	n += 1
print(n)


def ss(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s

def main():
	n = int(input())
	while ss(n) % 4 != 0:
		n += 1
	print(n)
main()


def f(x):
	sm = 0
	while x > 0:
		sm += int(x % 10)
		x /= 10
	return sm
a = int(input())
while 1:
	if f(a) % 4 == 0:
		print(a)
		break
	else:
		a += 1


def summ(mass):
	chi = 0
	for i in mass:
		chi += i
	return chi
n = int(input())
while True:
	a = str(n)
	a = summ(list(map(int, list(a))))
	if a % 4 == 0:
		break
	n += 1
print(n)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def f(n):
	s = str(n)
	c = 0
	for i in s:
		c += int(i)
	if c % 4 == 0:
		return 1
	else:
		return 0
a = ii()
while 1:
	if f(a):
		print(a)
		break
	a += 1


a = int(input())
x = a
while x != 0:
	s = str(x)
	r = 0
	f = len(s)
	for i in range(f):
		r += int(s[i])
	x += 1
	if r % 4 == 0:
		print(x - 1)
		x = 0


def getSum(n):
	sum = 0
	while n != 0:
		sum = sum + int(n % 10)
		n = int(n / 10)
	return sum
n = int(input())
for i in range(n, n + 11):
	if getSum(i) % 4 == 0:
		print(i)
		break


s = input()
n = int(s)
l1 = [int(x) for x in s]
if sum(l1) % 4 == 0:
	print(n)
	exit(0)
while 1:
	n = n + 1
	s = str(n)
	l1 = [int(x) for x in s]
	if sum(l1) % 4 == 0:
		print(n)
		exit(0)


n = int(input())
while 1:
	l = list((int(x) for x in str(n)))
	if sum(l) % 4 == 0:
		print(n)
		break
	else:
		n = n + 1


n = int(input()) - 1
while 1:
	n += 1
	if sum(list(map(int, list(str(n))))) % 4 == 0:
		break
print(n)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		q = 1
		while q:
			count = 0
			t = n
			while t > 0:
				count += t % 10
				t //= 10
			if count % 4 == 0:
				q = 0
				break
			else:
				n += 1
		print(n)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


a = int(input())
while 1:
	if sum(map(int, str(a))) % 4:
		a = a + 1
	else:
		print(a)
		break


n = int(input())
d = 0
k = 0
for i in range(n, 110000):
	k = str(i)
	for l in k:
		d += int(l)
	if d % 4 == 0:
		print(k)
		exit()
	d = 0
	k = 0


import math
done = False
x = int(input())

def sum_digits(x):
	s = 0
	while x:
		s += x % 10
		x //= 10
	return s
while not done:
	if sum_digits(x) % 4 == 0:
		print(x)
		done = True
		break
	else:
		x += 1


import sys

def eprint(*args, **kwargs):
	if __debug__:
		print(*args, file=sys.stderr, **kwargs)

def sum_of_digit(num):
	n = num
	res = 0
	while n != 0:
		res += n % 10
		n //= 10
	return res
eprint('Local')
a = int(input())
while sum_of_digit(a) % 4 != 0:
	a += 1
print(a)


def getReq(num):
	digs = [int(x) for x in list(str(num))]
	rem4 = sum(digs) % 4
	if rem4 == 0:
		return num
	if 4 - rem4 <= 9 - digs[-1]:
		digs[-1] += 4 - rem4
		return int(''.join([str(x) for x in digs]))
	num += 10 - digs[-1]
	digs = [int(x) for x in list(str(num))]
	rem4 = sum(digs) % 4
	if rem4 > 0:
		digs[-1] += 4 - rem4
	return int(''.join([str(x) for x in digs]))
n = int(input())
print(getReq(n))


def interesting(a):
	while True:
		suma = 0
		s = str(a)
		for i in s:
			suma += int(i)
		if suma % 4 == 0:
			return a
		else:
			a += 1
a = int(input())
print(interesting(a))


def summa(x):
	x = str(x)
	otv = 0
	for i in x:
		otv += int(i)
	return otv
n = int(input())
a = n
while summa(a) % 4 != 0:
	a += 1
print(a)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = list(ip())
s = 0
for i in t:
	s += int(i)
while s % 4 != 0:
	t = int(''.join(t)) + 1
	t = list(str(t))
	s = 0
	for i in t:
		s += int(i)
print(int(''.join(t)))


def sod(n):
	s = 0
	while n > 0:
		r = n % 10
		n = n // 10
		s = s + r
	return s
n = int(input())
while 1:
	if sod(n) % 4 == 0:
		break
	else:
		n = n + 1
print(n)


def Sum(n):
	temp = n
	s = 0
	while temp > 0:
		t = temp % 10
		s += t
		temp //= 10
	return s
n = int(input())
i = 0
while Sum(n + i) % 4 != 0:
	i += 1
print(n + i)


n = int(input())
p = [int(k) for k in str(n)]
i = 1
while sum(p) % 4 != 0:
	n = n + 1
	p = [int(k) for k in str(n)]
p = [str(k) for k in str(n)]
print(''.join(p))


def summ(n):
	t = 0
	for i in n:
		t += int(i)
	return t
n = input()
while True:
	if summ(n) % 4 == 0:
		break
	n = str(int(n) + 1)
print(n)


a = input()

def digitsum(a):
	ds = 0
	for i in range(len(a)):
		ds += int(a[i])
	return ds
for i in range(10):
	if digitsum(str(int(a) + i)) % 4 == 0:
		print(int(a) + i)
		break


def sum(n):
	sum = 0
	while n != 0:
		sum += n % 10
		n /= 10
		n = int(n)
	return sum
a = int(input())
while True:
	if sum(a) % 4 == 0:
		print(a)
		break
	a += 1


a = int(input())
inter = False
while not inter:
	a_str = str(a)
	s = 0
	for el in a_str:
		s += int(el)
	if s % 4 == 0:
		inter = True
	else:
		a += 1
print(a)


n = int(input())

def rez(n):
	summ = 0
	while n > 0:
		summ += int(n % 10)
		n = int(n // 10)
	return summ
while rez(n) % 4 != 0:
	n += 1
print(n)


a = input()
while True:
	offset = sum((int(x) for x in a)) % 4
	if offset == 0:
		break
	a = str(int(a) + 1)
print(a)


a = int(input())
for i in range(a, 2001):
	s = 0
	t = i
	while t:
		s += t % 10
		t //= 10
	if s % 4 == 0:
		print(i)
		break


a = int(input())

def digit_sum(a):
	sumi = 0
	while a != 0:
		sumi += a % 10
		a = a // 10
	return sumi
x = digit_sum(a)
if x % 4 == 0:
	print(a)
else:
	while digit_sum(a) % 4 != 0:
		a += 1
	print(a)


a = int(input())

def sumdig(a):
	sum = 0
	while a > 0:
		sum += a % 10
		a = a // 10
	return sum
while sumdig(a) % 4 != 0:
	a = a + 1
print(a)


def sum_of_numbers(x):
	x = list(x)
	m = [int(u) for u in x]
	return sum(m)

def nearest(x):
	a = int(x)
	while sum_of_numbers(x) % 4 != 0:
		a += 1
		x = str(a)
	return a
print(nearest(input()))


a = input()
while True:
	sm = 0
	for i in a:
		sm += int(i)
	if sm % 4 == 0:
		print(a)
		break
	a = str(int(a) + 1)


a = int(input())
summ = 5
while summ % 4 != 0:
	summ = 0
	a = str(a)
	for i in a:
		summ += int(i)
	if summ % 4 != 0:
		a = int(a) + 1
print(a)


(z, zz, dgraphs) = (input, lambda : list(map(int, z().split())), {})
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = int(z())
for i in range(n, 10001):
	l = sum(list(map(int, str(i))))
	if l % 4 == 0:
		print(i)
		exit()


def isInteresting(n):
	s = str(n)
	totalsum = 0
	for i in s:
		totalsum += int(i)
	return totalsum
a = int(input())
totalsum = isInteresting(a)
if totalsum % 4 == 0:
	print(a)
else:
	x = totalsum % 4
	x = 4 - x
	if isInteresting(a + x) % 4 == 0:
		print(x + a)
	else:
		flag = 0
		for i in range(11):
			if isInteresting(a + i + 1) % 4 == 0:
				print(a + i + 1)
				flag = 1
				break
		if flag == 0:
			print(a + 11)


def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problem1():
	a = inp(int)
	n = -1
	while n < 0:
		s = 0
		tmp = a
		while tmp:
			s += tmp % 10
			tmp = tmp // 10
		if s % 4 == 0:
			n = a
		a += 1
	print(n)

def problem2():
	pass

def problem3():
	pass

def problem4():
	pass

def problem5():
	pass
problem1()


a = int(input())

def sumOFdid(a):
	s = 0
	while a > 0:
		s += a % 10
		a = a // 10
	return s
while True:
	if sumOFdid(a) % 4 == 0:
		print(a)
		break
	a += 1


import math

def number_of_digit(n):
	k = 0
	while n >= 1:
		n = n / 10
		k = k + 1
	return k

def sum_digits(n, k):
	a = n
	sum_digit = 0
	for i in range(k):
		sum_digit = sum_digit + a % 10
		a = a // 10
	return sum_digit

def interesting_number(n):
	a = n - 1
	while True:
		a = a + 1
		r = number_of_digit(a)
		if sum_digits(a, r) % 4 == 0:
			res = a
			break
	return res
n = int(input())
print(interesting_number(n))


a = input()
while True:
	lst = list(a)
	s = sum((int(lst[i]) for i in range(len(lst))))
	if s % 4 == 0:
		print(int(a))
		break
	else:
		a = str(int(a) + 1)


def sd(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
a = int(input())
for i in range(a, a + 100000):
	if sd(i) % 4 == 0:
		print(i)
		break


a = input()
x = 0
sum = 1
while x != 1:
	sum = 0
	for i in range(0, len(a)):
		sum = sum + int(a[i])
	if sum % 4 == 0:
		x = x + 1
	else:
		a = str(int(a) + 1)
print(a)


q = int(input())
e = 1
while e == 1:
	n = 0
	w = q
	while q > 0:
		n += q % 10
		q //= 10
	if n % 4 == 0:
		e = 0
	q = w + 1
print(w)


s = input()
for i in range(100):
	l = [int(i) for i in s]
	if sum(l) % 4 == 0:
		print(s)
		break
	else:
		n = int(s)
		s = str(n + 1)


a = int(input())
for i in range(1, 2000):
	s = list(str(i))
	s = list(map(int, s))
	if sum(s) % 4 == 0 and i >= a:
		print(i)
		exit()


x = int(input())
while sum(map(int, str(x))) % 4:
	x += 1
print(x)


t = str(input())
sum1 = 0

def sum2(a):
	sumq = 0
	for i in range(len(a)):
		sumq += int(a[i])
	return sumq
while True:
	sum12 = sum2(t)
	s = int(sum12 % 4)
	if s == 0:
		print(int(t) + s)
		break
	else:
		t = str(int(t) + 1)


a = int(input())
sum_a = 0
for i in str(a):
	sum_a += int(i)
while sum_a % 4 != 0:
	a += 1
	sum_a = 0
	for i in str(a):
		sum_a += int(i)
print(a)


N = input()
while True:
	A = list(N)
	A = [int(i) for i in A]
	s = sum(A)
	if s % 4 == 0:
		break
	N = int(N) + 1
	N = str(N)
print(N)


def nearest(n):
	if n < 10:
		return n
	return nearest(n // 10) + n % 10
ii = int(input())
number = nearest(ii)
val = number
if number % 4 == 0:
	val = number
while val % 4 != 0:
	ii += 1
	val = nearest(ii)
print(ii)


def sumOfDigits(n):
	summ = 0
	for i in n:
		summ += int(i)
	return summ
import math
n = input()
for i in range(8):
	if sumOfDigits(str(n)) % 4 == 0:
		break
	n = int(n) + 1
print(n)


def s(n):
	su = 0
	while n != 0:
		su = su + n % 10
		n = n // 10
	return su
n = int(input())
for i in range(n, n + 10):
	if s(i) % 4 == 0:
		print(i)
		break


def summas(a):
	result = 0
	while a > 0:
		result += a % 10
		a //= 10
	return result % 4
n = int(input())
while summas(n) != 0:
	n += 1
print(n)


def sum1(n):
	sum = 0
	a = n
	while n > 0:
		r = n % 10
		sum += r
		n = n // 10
	return sum
n = int(input())
p = sum1(n)
p = p % 4
while p != 0:
	n = n + 1
	p = sum1(n)
	p = p % 4
print(n)


def Sumr(el):
	q = 0
	for i in el:
		q += int(i)
	return q
a = input()
r = int(a)
while Sumr(a) % 4 != 0:
	a = int(a)
	a += 1
	a = str(a)
print(a)


a = int(input())

def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
su = sum_digits(a)
if su % 4 == 0:
	print(a)
else:
	for i in range(100):
		if sum_digits(a + i) % 4 == 0:
			print(a + i)
			break


x = 0
a = str(input())
b = int(a)
while True:
	for i in a:
		x += int(i)
	if x % 4 == 0:
		print(b)
		exit()
	else:
		b += 1
		a = str(b)
		x = 0


def sod(q):
	sum = 0
	while q != 0:
		sum = sum + q % 10
		q = q // 10
	return sum
n = int(input())
p = 0
while p != 1:
	if sod(n) % 4 == 0:
		print(n)
		p = 1
	else:
		n = n + 1


num = input()
sum = 0
int_num = int(num)
for i in num:
	sum += int(i)
if sum % 4 == 0:
	print(num)
else:
	while sum % 4 != 0:
		sum = 0
		int_num += 1
		for j in str(int_num):
			sum = sum + int(j)
	print(int_num)


n = int(input())
for i in range(n, n + 10):
	x = list(str(i))
	sum = 0
	for j in x:
		sum += int(j)
	if sum % 4 == 0:
		print(''.join((p for p in x)))
		break


n = int(input())
while 1:
	k = str(n)
	m = 0
	for i in range(len(k)):
		m += int(k[i])
	if m % 4 == 0:
		break
	else:
		n += 1
print(n)


a = int(input())

def divisibility_4(q):
	sumdigits = 0
	ans = q
	while q:
		sumdigits += q % 10
		q //= 10
	if sumdigits % 4 == 0:
		return ans
if divisibility_4(a):
	print(divisibility_4(a))
else:
	while not divisibility_4(a):
		a += 1
	else:
		print(divisibility_4(a))


def s(x):
	ss = 0
	while x > 0:
		ss += x % 10
		x = x // 10
	return ss
a = int(input())
for i in range(a, a + 1000):
	if s(i) % 4 == 0:
		print(i)
		break


n = int(input())
cnt = 0
llist = [int(x) for x in str(n)]
while True:
	cnt = sum(llist)
	if cnt % 4 == 0:
		llist = [str(x) for x in llist]
		print(''.join(llist))
		break
	else:
		n += 1
		llist = [int(x) for x in str(n)]


def main():
	a = input()
	while True:
		summ = sum(map(int, list(a)))
		if summ % 4 == 0:
			print(a)
			return
		a = str(int(a) + 1)
main()


n = int(input())

def summ(n):
	s = 0
	for el in str(n):
		s += int(el)
	return s
while summ(n) % 4 != 0:
	n += 1
print(n)


def sod(n):
	s = 0
	while n != 0:
		s += n % 10
		n //= 10
	return s
k = int(input())
if sod(k) % 4 == 0:
	print(k)
else:
	k += 1
	while sod(k) % 4 != 0:
		k += 1
	print(k)


def func(number):
	p = 0
	for i in str(number):
		p += int(i)
	return p
a = int(input())
while func(a) % 4 != 0:
	a += 1
print(a)


def cou(a):
	s = 0
	for i in range(len(a)):
		s += int(a[i])
	if s % 4 == 0:
		print(a)
	else:
		b = str(int(a) + 1)
		cou(b)
a = input()
cou(a)


n = int(input())
test = []
test.append(n)
for i in test:
	count = 0
	j = str(i)
	k = list(j)
	for l in k:
		count = count + int(l)
	if count % 4 == 0:
		print(i)
	else:
		n = n + 1
		test.append(n)


def interesting_number(n):
	(k, s) = (n, 0)
	while True:
		k = n
		while n != 0:
			s += n % 10
			n //= 10
		if s % 4 == 0:
			break
		n = k
		n += 1
		s = 0
	return k
print(interesting_number(int(input())))


n = int(input())
dsum = sum([int(x) for x in str(n)])
while dsum % 4 != 0:
	n += 1
	dsum = sum([int(x) for x in str(n)])
print(n)


N = int(input())
FLAG = 0
while FLAG == 0:
	count = 0
	S = list(str(N))
	for j in S:
		count += int(j)
	if count % 4 == 0:
		X = ''.join(S)
		print(X)
		FLAG = 1
		break
	N += 1


gi = lambda : list(map(int, input().strip().split()))

def sod(x):
	return sum([int(e) for e in list(str(x))])
(n,) = gi()
ans = n
while sod(ans) % 4 != 0:
	ans += 1
print(ans)


n = input()

def su(n):
	s = 0
	for i in range(len(n)):
		s = s + int(n[i])
	return s
while su(n) % 4 != 0:
	n = str(int(n) + 1)
print(n)


def nihar(a):
	su = 0
	while a > 0:
		i = a % 10
		su += i
		a = int(a / 10)
	return su % 4 == 0
n = int(input())
while True:
	if nihar(n):
		print(n)
		break
	else:
		n = n + 1


a = int(input())
sm = 0
current = a
while current > 0:
	sm += current % 10
	current //= 10
while sm % 4 != 0:
	a += 1
	current = a
	sm = 0
	while current > 0:
		sm += current % 10
		current //= 10
print(a)


def f(a):
	a = str(a)
	return sum([int(i) for i in a])
a = int(input())
for n in range(a, a + 1000000):
	if f(n) % 4 == 0:
		print(n)
		break


def su(n):
	return sum(map(int, list(str(n))))
i = int(input())
while su(i) % 4:
	i += 1
print(i)


import math

def sod(n):
	a = str(n)
	result = 0
	for i in range(0, len(a)):
		result = result + int(a[i])
	if result % 4 == 0:
		return 1
	else:
		return 0
t = int(input())
while True:
	if sod(t) == 1:
		print(t)
		break
	else:
		t = t + 1


a = int(input())
for i in range(a, 10000):
	if sum(map(int, str(i))) % 4 == 0:
		print(i)
		break


a = int(input())
while True:
	if sum(map(int, str(a))) % 4 == 0:
		print(a)
		exit(0)
	else:
		a += 1


a = int(input())
while True:
	t = 0
	for c in str(a):
		t += int(c)
	if t % 4 == 0:
		print(a)
		break
	else:
		a += 1


def isValid(a):
	b = sum([int(d) for d in str(a)])
	return b % 4 == 0
a = int(input())
while not isValid(a):
	a += 1
print(a)


def su(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
n = int(input())
s = su(n)
if s % 4 == 0:
	print(n)
else:
	while s % 4 != 0:
		n += 1
		s = su(n)
	print(n)


n = input()
i = int(n)
while 1:
	s = sum(map(int, str(i)))
	if s % 4 == 0:
		print(i)
		break
	i += 1


def checkDivisible(n):
	temp = list(map(int, str(n)))
	sumOfDigits = sum(temp)
	if sumOfDigits % 4 == 0:
		return True

def main():
	n = int(input())
	while True:
		if checkDivisible(n) == True:
			print(n)
			return
		n += 1
main()


p = int(input())
n = p

def rtg(n):
	c = 0
	y = 0
	while n > 0:
		c = c + y
		y = n % 10
		n = n // 10
	return c + y
for i in range(p, p + 10):
	if rtg(i) % 4 == 0:
		print(i)
		break
	i = +1


def helper(n):
	summ = 0
	while n:
		summ += n % 10
		n //= 10
	if summ % 4 == 0:
		return True
	return False
n = int(input())
while True:
	if helper(n):
		print(n)
		break
	n += 1


def check(a):
	while True:
		Sum = sum([int(i) for i in list(str(a))])
		if Sum % 4 == 0:
			return a
		else:
			a += 1
a = int(input())
print(check(a))


def intnum(a):
	z = 0
	for i in range(len(a)):
		b = int(a[i])
		z += b
	if z % 4 == 0:
		return True
	else:
		return False
a = input()
z = 0
x = int(a)
for i in range(x, x + 10):
	if intnum(str(i)):
		print(i)
		break


n = input()
n1 = list(n)
while True:
	s = 0
	le = len(n1)
	for i in range(le):
		s += int(n1[i])
	if s % 4 == 0:
		print(n)
		break
	n = str(int(n) + 1)
	n1 = list(n)


def sum_digits(n):
	r = 0
	while n:
		(r, n) = (r + n % 10, n // 10)
	return r
a = int(input())
while sum_digits(a) % 4 != 0:
	a += 1
print('{}'.format(a))


a = input()
for i in range(int(a), 1004):
	num = str(i)
	div3 = 0
	for j in range(len(num)):
		div3 += int(num[j])
	if div3 % 4 == 0:
		ret = i
		break
print(ret)


n = int(input())

def is_interesting(a):
	summ = 0
	for i in str(a):
		summ += int(i)
	if summ % 4 == 0:
		return False
	return True
while is_interesting(n):
	n += 1
print(n)


def str_to_sum(n):
	s = 0
	for i in n:
		s += int(i)
	return s
n = input()
s = 0
s = str_to_sum(n)
if s % 4 == 0:
	print(n)
else:
	for j in range(1, 10):
		s = str_to_sum(str(int(n) + j))
		if s % 4 == 0:
			print(int(n) + j)
			break


a = int(input())
while sum(map(int, str(a))) % 4 > 0:
	a += 1
print(a)


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def read_string():
	return sys.stdin.readline().strip()

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l):
	print(' '.join(map(str, l)))

def check(n):
	tot = sum(map(lambda x: int(x), list(str(n))))
	return tot % 4 == 0
a = read_int()
while not check(a):
	a += 1
print(a)


n = int(input())
flag = 0
while flag == 0:
	a = 0
	b = str(n)
	for i in b:
		a += int(i)
	if a % 4 == 0:
		print(n)
		flag = 1
	else:
		n += 1


a = []
c = input()
s = 1
a = list(map(int, list(c)))
if sum(a) % 4 == 0:
	print(c)
else:
	while s % 4 != 0:
		c = int(c)
		c += 1
		c = str(c)
		a = list(map(int, list(c)))
		s = sum(a)
	print(int(c))


n = input()
a = 1
while a != 0:
	c = 0
	l = []
	for i in str(n):
		l.append(int(i))
	for i in l:
		c += i
	if c % 4 == 0:
		print(n)
		a = 0
	else:
		n = int(n) + 1
		l.clear()


a = int(input())
b = a
j = 0
m = -1
while m % 4 != 0:
	m = 0
	b = a + j
	j += 1
	sum = 0
	while b != 0:
		m += b % 10
		b //= 10
print(a + j - 1)


a = input()
while True:
	s = 0
	for ai in a:
		s += int(ai)
	mod = s % 4
	if mod:
		mod = 4 - mod
		if int(a[-1]) <= 9 - mod:
			print(int(a) + mod)
			break
		else:
			a = str(int(a) + 10 - int(a[-1]))
	else:
		print(a)
		break


n = int(input())
while True:
	x = n
	sum = 0
	while x > 0:
		sum += x % 10
		x //= 10
	if sum % 4 == 0:
		print(n)
		exit(0)
	n += 1


def kv(n):
	s = str(n)
	c = 0
	for i in s:
		c += int(i)
	return c
n = int(input())
while kv(n) % 4 != 0:
	n += 1
print(n)


n = int(input())
s = n
r = 0
while s > 0:
	r = r + s % 10
	s = s // 10
if r % 4 == 0:
	print(n)
else:
	while 1:
		n = n + 1
		s = n
		r = 0
		while s > 0:
			r = r + s % 10
			s = s // 10
		if r % 4 == 0:
			print(n)
			exit()


A = int(input())
while True:
	X = [int(i) for i in str(A)]
	if sum(X) % 4 == 0:
		print(int(A))
		break
	A += 1


n = input()
sum1 = 0
for i in n:
	sum1 += int(i)
if sum1 % 4 == 0:
	print(n)
else:
	while sum1 % 4 != 0:
		n = str(1 + int(n))
		sum1 = 0
		for i in n:
			sum1 += int(i)
	print(n)


a = input()
n = len(a)
tong = 0
for i in range(n):
	tong += int(a[i])
if tong % 4 == 0:
	print(a)
else:
	b = int(a)
	if int(a[n - 1]) + 4 - int(tong % 4) <= 9:
		b = b + 4 - int(tong % 4)
	else:
		b = b + 10 - int(a[n - 1])
	a = str(b)
	n = len(a)
	tong = 0
	for i in range(n):
		tong += int(a[i])
	if tong % 4 == 0:
		print(a)
	else:
		b = int(a)
		b = b + 4 - tong % 4
		a = str(b)
		print(a)


def four(x):
	s = 0
	while x:
		s += x % 10
		x //= 10
	return s
a = int(input())
while True:
	if four(a) % 4 == 0:
		print(a)
		break
	a += 1


def sum_digits(n):
	s = 0
	for i in str(n):
		s += int(i)
	return s

def go():
	n = int(input())
	x = sum_digits(n)
	while x % 4 != 0:
		n += 1
		x = sum_digits(n)
	return n
print(go())


n = int(input())
while True:
	if sum(map(int, str(n))) % 4 == 0:
		break
	else:
		n += 1
print(n)


z = input()
x = list(map(lambda a: int(a), list(z)))
t = sum(x)
while t % 4 != 0:
	z = int(z)
	z += 1
	t = sum(list(map(lambda a: int(a), list(str(z)))))
print(z)


a = int(input())
lst = [int(i) for i in str(a)]
if sum(lst) % 4 == 0:
	print(a)
else:
	while sum(lst) % 4 != 0:
		a = a + 1
		lst = [int(i) for i in str(a)]
	print(a)


def ss(a):
	q = 0
	while a != 0:
		q += a % 10
		a = a // 10
	return q
a = int(input())
s = ss(a)
while s % 4 != 0:
	a += 1
	s = ss(a)
print(a)


def sm(a):
	res = 0
	while a > 0:
		res += a % 10
		a //= 10
	return res
a = int(input())
while sm(a) % 4:
	a += 1
print(a)


a = input()
k = list(map(int, a))
b = sum(k)
if b % 4 == 0:
	print(a)
else:
	c = b // 4 + 1
	d = 4 * c - b
	a = int(a)
	if (a + 1) % 400 == 0:
		z = a + 1
		print(z)
	elif (a + 2) % 400 == 0:
		z = a + 2
		print(z)
	else:
		e = a + d
		f = map(int, str(e))
		g = sum(f)
		if g % 4 == 0:
			print(e)
		else:
			h = g // 4 + 1
			i = h * 4 - g
			j = e + i
			j = int(j)
			print(j)


n = int(input())
sm = sum(map(int, list(str(n))))
while sm % 4 != 0:
	n += 1
	sm = sum(map(int, list(str(n))))
print(n)


def main():
	s = input()
	n = [int(i) for i in s]
	while sum(n) % 4 != 0:
		s = str(int(s) + 1)
		n = [int(i) for i in s]
	print(s)
main()


n = int(input())
ss = 0
x = str(n)
for i in x:
	ss += int(i)
if ss % 4 == 0:
	print(n)
	exit()
for i in range(n + 1, 10010):
	ss = 0
	for j in str(i):
		ss += int(j)
	if ss % 4 == 0:
		print(i)
		exit()


def digit_sum(a):
	return sum(map(int, list(a)))
num = int(input())
out = num
for i in range(50):
	if digit_sum(str(num + i)) % 4 == 0:
		out = num + i
		break
print(out)


n = int(input())

def isInter(n):
	n = str(n)
	n = [int(i) for i in n]
	return True if sum(n) % 4 == 0 else False
while True:
	if isInter(n):
		print(n)
		exit(0)
	else:
		n += 1


n = int(input())
found = False
while not found:
	sum = 0
	st = str(n)
	for i in st:
		sum += int(i)
	if sum % 4 == 0:
		found = True
	else:
		n += 1
print(n)


def hmm(n: int) -> int:
	a = 0
	while n != 0:
		a += n % 10
		n //= 10
	return a
n = int(input())
while hmm(n) % 4 != 0:
	n += 1
print(n)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
n = ini()
near = lambda n: sum((int(i) for i in str(n)))
while near(n) % 4 != 0:
	n += 1
print(n)


giv_num = int(input())
i = giv_num
while True:
	i_sum = sum([int(k) for k in str(i)])
	if i_sum % 4 == 0:
		break
	else:
		i = i + 1
print(i)


num = int(input())
sum = 0
flag = 0
while flag == 0:
	temp = num
	while temp > 0:
		rem = temp % 10
		sum = sum + rem
		temp = temp // 10
	if sum % 4 == 0:
		print(num)
		sum = 0
		flag = 1
	else:
		num += 1
		sum = 0


def sum_number(n):
	s = str(n)
	sum = 0
	for i in s:
		sum += int(i)
	return sum
n = int(input())
flag = 0
while flag != 1:
	t = sum_number(n)
	if t % 4 == 0:
		flag = 1
		print(n)
	else:
		n = n + 1


n = int(input())
while 1:
	s = str(n)
	c = 0
	for j in s:
		c = c + int(j)
	if c % 4 == 0:
		print(s)
		break
	n = n + 1


def count(s):
	sum = 0
	s = str(s)
	for elem in s:
		sum += int(elem)
	return sum
a = int(input())
while count(a) % 4 != 0:
	a += 1
print(a)


def sumnun(n):
	r = 0
	while n > 0:
		r += n % 10
		n //= 10
	return r
n = int(input())
while sumnun(n) % 4 != 0:
	n += 1
print(n)


n = int(input())
sum = 0
k = n
while k > 0:
	sum += k % 10
	k //= 10
if sum % 4 == 0:
	print(n)
else:
	while True:
		n += 1
		k = n
		sum = 0
		while k > 0:
			sum += k % 10
			k //= 10
		if sum % 4 == 0:
			print(n)
			break


from sys import stdin
n = int(stdin.readline())

def nextfour(n):
	o = n
	t = 0
	while o > 0:
		t += o % 10
		o //= 10
	if t % 4 == 0:
		print(n)
	else:
		nextfour(n + 1)
nextfour(n)


import sys
data = sys.stdin.readlines()
a = int(data[0])

def mult4(x):
	suma = sum((int(digit) for digit in str(x)))
	return suma % 4 == 0
i = a
while True:
	if mult4(i):
		print(i)
		exit()
	else:
		i += 1


def summa(n):
	n = list(map(int, list(str(n))))
	return sum(n)
n = int(input())
while summa(n) % 4:
	n += 1
print(n)


def sumd(n):
	q = 0
	for j in str(n):
		q += int(j)
	return q
a = str(input())
b = sumd(a) % 4
if b == 0:
	print(int(a))
else:
	for i in range(7):
		if sumd(int(a) + i) % 4 == 0:
			print(int(a) + i)
			break


n = int(input())
m = 0
h = 1
k = n
while h != 2:
	l = k
	while l // 10 != 0:
		m += l % 10
		l //= 10
	m += l
	if m % 4 == 0:
		print(k)
		break
	else:
		m = 0
	k += 1


import math
n = int(input())
while 1:
	n = str(n)
	l = [int(n[i]) for i in range(len(n))]
	r = int(math.fsum(l))
	if r % 4 == 0:
		print(n)
		break
	else:
		n = int(n)
		n += 1


import sys
input = sys.stdin.readline
a = int(input())
while a:
	temp = a
	s = 0
	while temp:
		s += temp % 10
		temp = temp // 10
	if s % 4 == 0:
		print(a)
		break
	a += 1


def solve(n):
	while True:
		if sum(list(map(int, str(n)))) % 4 == 0:
			return n
		n += 1

def main():
	n = int(input())
	print(solve(n))
main()


n = int(input())
for i in range(n, 1000000):
	temp = list(str(i))
	sum_ = 0
	for j in temp:
		sum_ += int(j)
	if sum_ % 4 == 0:
		print(i)
		break
	else:
		continue


def digit_sum(n):
	sum_of_digit = 0
	while n != 0:
		sum_of_digit += n % 10
		n //= 10
	return sum_of_digit

def main():
	n = int(input())
	while digit_sum(n) % 4 != 0:
		n += 1
	print(n)
main()


x = int(input())
sum = x % 10 + x // 10 % 10 + x // 100 % 10 + x // 1000
while sum % 4 != 0:
	x = x + 1
	sum = x % 10 + x // 10 % 10 + x // 100 % 10 + x // 1000
	if sum % 4 == 0:
		break
print(x)


a = int(input())
while True:
	temp = a
	s = 0
	while temp != 0:
		s += temp % 10
		temp //= 10
	if s % 4 == 0:
		break
	a += 1
print(a)


def sum(x):
	s = int(0)
	while x > 0:
		s = s + x % 10
		x = x // 10
	return s % 4
a = input()
b = int(a)
while sum(b) != 0:
	b = b + 1
print(b)


a = int(input())

def interesting(n):
	s = int(0)
	while n > 0:
		s += n % 10
		n = int(n / 10)
	if s % 4 == 0:
		return True
	else:
		return False
while interesting(a) == False:
	a += 1
print(a)


n = int(input())
for i in range(n, 1005):
	n1 = [int(j) for j in str(i)]
	sn1 = sum(n1)
	if sn1 % 4 == 0:
		print(i)
		break


from sys import stdin
a = int(stdin.readline().strip())

def sum_digits(n):
	res = 0
	while n:
		res += n % 10
		n //= 10
	return res
for i in range(a, a + 10):
	if sum_digits(i) % 4 == 0:
		print(i)
		break


n = int(input())
m = sum(map(int, list(str(n))))
if m % 4 == 0:
	print(n)
else:
	while m % 4 != 0:
		n += 1
		m = sum(map(int, list(str(n))))
	print(n)


n = int(input())
m = n
while True:
	s = str(m)
	t = sum([int(c) for c in s])
	if t % 4 == 0:
		break
	m += 1
print(m)


def sod(num):
	ans = 0
	for i in str(num):
		ans += int(i)
	return ans
n = int(input())
for i in range(n, n + 100):
	if sod(i) % 4 == 0:
		print(i)
		exit()


n = int(input())
t = n
s = 0
while n > 0:
	s = s + n % 10
	n = n // 10
while s % 4 != 0:
	s = 0
	t = t + 1
	n = t
	while n > 0:
		s = s + n % 10
		n = n // 10
print(t)


s = input()
n = int(s)

def sum_digit(n):
	n = str(n)
	r = []
	for i in n:
		r.append(int(i))
	return sum(r)
while sum_digit(n) % 4 != 0:
	n += 1
print(n)


def digit_sum(n):
	r = 0
	while n:
		r += n % 10
		n //= 10
	return r
a = int(input())
while digit_sum(a) % 4 != 0:
	a += 1
print(a)


a = input()
sum = 0
for k in range(len(a)):
	sum += int(a[k])
b = sum % 4
if b == 0:
	print(a)
else:
	while sum % 4 != 0:
		a = str(int(a) + 1)
		if int(a) % 10 == 0:
			sum = 0
			for k in range(len(a)):
				sum += int(a[k])
		else:
			sum += 1
	print(a)


n = input()
k = True
while k:
	if not sum(list(map(int, n))) % 4:
		print(n)
		break
	n = str(int(n) + 1)


def sodigits(n):
	s = str(n)
	sd = 0
	for i in range(0, len(s)):
		sd += int(s[i])
	return sd
n = int(input())
if sodigits(n) % 4 == 0:
	print(n)
else:
	for i in range(n, n + 10):
		if sodigits(i) % 4 == 0:
			print(i)
			break


s = input()
sum = 0
for i in s:
	sum += int(i)
if sum % 4 == 0:
	print(s)
else:
	i = 1
	t = s
	while i <= 100:
		sum = 0
		t = int(s) + i
		for j in str(t):
			sum += int(j)
		if sum % 4 == 0:
			print(t)
			break
		i += 1


def suma(n):
	sumb = 0
	while n > 0:
		sumb = sumb + n % 10
		n = n // 10
	return sumb
n = int(input())
p = True
while p:
	if suma(n) % 4 == 0:
		print(n)
		p = False
	else:
		n = n + 1


number = int(input())
while 1:
	digits_sum = sum(list(map(lambda x: int(x), str(number))))
	if digits_sum % 4 == 0:
		break
	number += 1
print(number)


a = int(input())
while sum((int(x) for x in str(a))) % 4:
	a += 1
print(a)


def func(a):
	s = str(a)
	sum1 = 0
	for i in s:
		sum1 += int(i)
	if sum1 % 4 == 0:
		return True
	else:
		return False
a = int(input())
while func(a) == False:
	a = a + 1
print(a)


def findsum(n):
	tempo = str(n)
	total = 0
	for p in tempo:
		total += int(p)
	return total
n = int(input())
while findsum(n) % 4 != 0:
	n += 1
print(n)


def sum_mod(x, y=4):
	temp = 0
	x = str(x)
	for i in x:
		temp += int(i)
	return temp % y
a = int(input())
while sum_mod(a) != 0:
	a += 1
print(a)


def somme(x):
	som = 0
	for i in x:
		som += int(i)
	return som
n = int(input())
while True:
	if somme(str(n)) % 4 == 0:
		print(n)
		break
	n += 1


def sum(o):
	a = 0
	for j in str(o):
		a = a + int(j)
	return a
i = input()
i = int(i)
while sum(i) % 4:
	i = i + 1
print(i)


a = int(input())
while True:
	t = a
	d = 0
	while t > 0:
		d += t % 10
		t = t // 10
	if d % 4 == 0:
		print(a)
		break
	a += 1


import math
import sys

def sumnum(a):
	sum1 = 0
	while a != 0:
		dg = int(a % 10)
		sum1 = int(sum1 + dg)
		a = int(a / 10)
	return int(sum1)
a = int(input())
sum1 = sumnum(a)
if sum1 % 4 == 0:
	print(a)
else:
	num2 = int(math.ceil(a / 4))
	num2 = num2 * 4
	if sumnum(num2) % 4 != 0:
		num2 = sys.maxsize
	while sumnum(a) % 4 != 0:
		sum1 = sumnum(a)
		num1 = sum1 % 4
		a = a + (4 - num1)
	print(min(num2, a))


number = int(input())
sum = 0
while 1 == 1:
	temp = number
	while temp != 0:
		sum = sum + temp % 10
		temp = temp // 10
	if sum % 4 == 0:
		print(number, '\n')
		break
	else:
		sum = 0
		number += 1


def c(a):
	sums = 0
	while a != 0:
		sums += a % 10
		a //= 10
	return sums
a = int(input())
for i in range(a, 1005):
	if c(i) % 4 == 0:
		print(i)
		break


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b):
	return abs(a[0] - b[0]) + abs(b[1] - a[1])

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def eld(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
n = [int(i) for i in input()]
x = sum(n) % 4
if x == 0:
	print(''.join(map(str, n)))
else:
	z = int(''.join(map(str, n)))
	for i in range(z, 10000):
		if sum([int(i) for i in str(i)]) % 4 == 0:
			print(i)
			exit(0)


from sys import stdin
input = stdin.readline

def sum(a):
	c = 0
	for i in str(a):
		c += int(i)
	return c
a = int(input())
while sum(a) % 4 != 0:
	a += 1
print(a)


n = int(input())
while True:
	string = str(n)
	sum_dig = 0
	for c in string:
		sum_dig += int(c)
	if sum_dig % 4 == 0:
		break
	n += 1
print(n)


num = input()
find = True
target = int(num)

def digit_sum(num: int):
	digit_sum = 0
	while num != 0:
		digit_sum += num % 10
		num = num // 10
	return digit_sum
while find:
	digitsum = digit_sum(target)
	if digitsum % 4 == 0:
		find = False
		print(target)
	else:
		target = target + 1


a = int(input())
while True:
	s = str(a)
	sum = 0
	for i in s:
		sum += int(i)
	if sum % 4 == 0:
		print(s)
		break
	a += 1


n = int(input())
for i in range(50000):
	if sum((int(digit) for digit in str(n + i))) % 4 == 0:
		print(n + i)
		break


def su(x):
	a = str(x)
	s = 0
	for i in range(len(a)):
		s += int(a[i])
	return s
a = int(input())
while True:
	if su(a) % 4 == 0:
		print(a)
		break
	else:
		a += 1


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def int1():
	return int(input())
import string
import math
from itertools import combinations

def main():
	n = int1()

	def sum1(n):
		s = 0
		while n > 0:
			s = s + n % 10
			n = n // 10
		return s
	k = 0
	if sum1(n) % 4 == 0:
		print(n)
	else:
		i = 1
		while i < 1000:
			n = n + 1
			if sum1(n) % 4 == 0:
				k = 1
				break
			i = i + 1
		if k == 1:
			print(n)
main()


n = int(input())
while 1:
	l = list(str(n))
	l1 = []
	for i in l:
		l1.append(int(i))
	if sum(l1) % 4 == 0:
		print(n)
		break
	n += 1


string = input()
count = 0
while 1:
	count = 0
	for i in string:
		count += int(i)
	if count % 4 == 0:
		print(string)
		break
	else:
		val = int(string) + 1
		string = str(val)


def check(n):
	s = str(n)
	su = 0
	for i in range(len(s)):
		su += int(s[i])
	if su % 4 == 0:
		return n
	else:
		return check(n + 1)
n = int(input())
print(check(n))


n = int(input())
v = n
while True:
	sum = 0
	x = v
	while x != 0:
		sum = sum + x % 10
		x = x // 10
	if sum % 4 == 0:
		print(v)
		break
	else:
		v += 1


def isInter(m):
	n = str(m)
	n = [n[i] for i in range(len(n))]
	n = list(map(int, n))
	n = sum((n[i] for i in range(len(n))))
	return n % 4 == 0
i = int(input())
while not isInter(i):
	i += 1
print(i)


num = int(input())
while True:
	num_s = str(num)
	r = 0
	for i in num_s:
		o = int(i)
		r += o
	if r % 4 == 0:
		break
	num += 1
print(num)


a = input()
lis = list(map(int, a))
if sum(lis) % 4 == 0 and a != '0':
	pass
elif a == '0':
	a = '4'
else:
	while sum(lis) % 4 != 0:
		a = str(int(a) + 1)
		lis = list(map(int, a))
print(a)


def dsum(i):
	sums = 0
	for j in str(i):
		sums += int(j)
	return sums
n = int(str(input()))
while dsum(n) % 4:
	n += 1
print(n)


n = int(input())
for m in range(n, n + 10):
	s = sum([int(i) for i in str(m)])
	if s % 4 == 0:
		print(m)
		break


def f(n):
	ln = []
	while n > 0:
		ln.append(n % 10)
		n = n // 10
	return sum(ln)
n = int(input())
while True:
	if f(n) % 4 == 0:
		print(n)
		break
	n = n + 1


def main():

	def is_interesting(n):
		s = 0
		while n:
			s += n % 10
			n //= 10
		if s % 4 == 0:
			return 1
		return 0
	import sys
	input = sys.stdin.readline
	a = int(input())
	while not is_interesting(a):
		a += 1
	print(a)
	return 0
main()


n = int(input())
num_sum = lambda n: sum((int(x) for x in list(str(n))))
if num_sum(n) % 4 == 0:
	print(n)
elif n == 799:
	print(n + 1)
elif n == 399:
	print(n + 1)
else:
	part = 4 - num_sum(n) % 4
	n += part
	if num_sum(n) % 4 == 0:
		print(n)
	else:
		new_part = 4 - num_sum(n) % 4
		n += new_part
		print(n)


def interesting(a):
	res = 0
	while a != 0:
		res += a % 10
		a //= 10
	if res % 4 == 0:
		return True
	else:
		return False
a = int(input())
while True:
	if interesting(a):
		print(a)
		break
	a += 1


def check(a):
	sum = 0
	for i in range(len(a)):
		sum += int(a[i])
	if sum % 4 == 0:
		return False
	else:
		return True
a = input()
i = int(a)
while check(str(i)):
	i += 1
print(str(i))


n = int(input())
while True:
	(x, s) = (n, 0)
	while x != 0:
		s += x % 10
		x //= 10
	if s % 4 == 0:
		print(n)
		break
	n += 1


n = int(input())
s = str(n)
ans = 0
c = 0
while True:
	ans = 0
	for i in s:
		ans += int(i)
	if ans % 4 == 0:
		c = s
		break
	else:
		s = str(int(s) + 1)
print(c)


Number = input()
while True:
	if sum((int(i) for i in Number)) % 4 == 0:
		print(Number)
		break
	Number = str(int(Number) + 1)


n = str(input())
k = 0
for i in range(len(n)):
	k = k + int(n[i])
while k % 4 != 0:
	n = str(int(n) + 1)
	k = 0
	for i in range(len(n)):
		k = k + int(n[i])
print(n)


def check(a):
	sumd = 0
	while a != 0:
		d = a % 10
		sumd += d
		a = a // 10
	if sumd % 4 == 0:
		return True
	return False
a = int(input())
ans = 0
while True:
	if check(a):
		ans = a
		break
	else:
		a += 1
print(ans)


def sum_digits(n):
	return sum((int(i) for i in str(n)))
n = int(input())
if sum_digits(n) % 4 == 0:
	print(n)
else:
	while sum_digits(int(n)) % 4 != 0:
		n += 1
	print(n)


x = int(input())
while 1:
	if sum(list(map(int, str(x)))) % 4 != 0:
		x += 1
	else:
		print(x)
		break


intInput = int(input())

def isInteresting(num):
	numList = [int(x) for x in str(num)]
	sum = 0
	for item in numList:
		sum += item
	if sum % 4 == 0:
		return True
	return False
i = intInput
while True:
	if isInteresting(i):
		print(i)
		break
	i += 1


def sum_of_digits(n):
	summ = 0
	while n > 0:
		r = n % 10
		n = n // 10
		summ = summ + r
	return summ
n = int(input())
summ = sum_of_digits(n)
k = 0
r = n
while sum_of_digits(r) % 4 != 0:
	k = k + 1
	r = n + k
print(r)


n = int(input())
b = True

def sm(n):
	smm = 0
	while n > 0:
		rem = n % 10
		smm += rem
		n //= 10
	return smm
while b:
	ttl = sm(n)
	if ttl % 4 == 0:
		print(n)
		b = False
	else:
		n += 1


number = int(input())
finish = 0
while finish == 0:
	sum = 0
	for i in range(len(str(number))):
		sum += int(str(number)[i])
	if sum % 4 == 0:
		finish = 1
	else:
		number += 1
print(number)


a = int(input())
ls = [int(i) for i in str(a)]
while sum(ls) % 4 != 0:
	a += 1
	ls = [int(i) for i in str(a)]
print(a)


def check(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	if s % 4 == 0:
		return 1
	else:
		return 0
n = int(input())
for i in range(10):
	if check(n + i):
		print(n + i)
		break


def f(a):
	s = 0
	b = str(a)
	for i in range(len(b)):
		s += int(b[i])
	return s
a = int(input())
n = a
while f(n) % 4 != 0:
	n += 1
print(n)


a = int(input())
while True:
	A = a
	s = 0
	while A > 0:
		r = A % 10
		A = int(A / 10)
		s += r
	if s % 4 == 0:
		print(a)
		break
	else:
		a += 1


n = int(input())
for i in range(15):
	s = str(n + i)
	t = 0
	for j in s:
		t += int(j)
	if t % 4 == 0:
		print(s)
		break


n = int(input())

def getSum(x):
	return sum(map(int, str(x)))
while getSum(n) % 4 != 0:
	n += 1
print(n)


a = int(input())

def aon(a):
	a = str(a)
	ans = 0
	for i in a:
		ans += int(i)
	return ans % 4 == 0
while not aon(a):
	a += 1
print(a)


s = input()
sm = sum([int(i) for i in s])
n = int(s)
if sm % 4 == 0:
	print(n)
else:
	for i in range(1, 11):
		s = str(n + i)
		if sum([int(i) for i in s]) % 4 == 0:
			print(int(s))
			break


import sys
n = int(input())
while True:
	if sum([int(i) for i in str(n)]) % 4 == 0:
		break
	n += 1
print(n)


def sum_of_digits(a):
	s = 0
	while a > 0:
		s += a % 10
		a //= 10
	return s
a = int(input())
while sum_of_digits(a) % 4 != 0:
	a += 1
print(a)


n = int(input())
count = 0
for i in range(n, 10000):
	i = str(i)
	for j in range(len(i)):
		count += int(i[j])
	if count % 4 == 0:
		print(i)
		break
	else:
		count = 0


n = int(input())
key = 1
t = n
while key:
	counter = 0
	n = t
	while n:
		counter += n % 10
		n = n // 10
	if counter % 4 == 0:
		break
	else:
		t += 1
print(t)


input_num = int(input())
while True:
	sum_input = 0
	for e in list(str(input_num)):
		sum_input += int(e)
	if sum_input % 4 == 0:
		break
	input_num += 1
print(input_num)


n = int(input())
for i in range(n, 100000000000000):
	t = list(str(i))
	S = 0
	for j in range(0, len(t)):
		S += int(t[j])
	if S % 4 == 0:
		print(i)
		break


import sys

def getAndParseInt(num=1):
	string = sys.stdin.readline().strip()
	if num == 1:
		return int(string)
	else:
		return [int(part) for part in string.split()]

def getAndParseString(num=1, delim=''):
	string = sys.stdin.readline().strip()
	if num == 1:
		return string
	elif delim != '':
		return [part for part in string.split(delim)]
	else:
		return [part for part in string.split()]
n = getAndParseInt()

def checkDivBy4(num):
	rem = 0
	while num > 0:
		rem += num % 10
		num = num // 10
	return rem % 4
for num in range(n, 1004):
	if checkDivBy4(num) == 0:
		break
print(num)


p = 4
l = []
l1 = [0]
for i in range(1, 1005 + 1):
	d = list(str(i))
	for j in d:
		l.append(int(j))
	s = sum(l)
	if s % 4 == 0:
		l1.append(i)
	l = []
n = int(input())
for i in range(1, len(l1)):
	if l1[i - 1] < n and l1[i] >= n:
		print(l1[i])


a = int(input())
x = 0
b = a
while b > 0:
	x += b % 10
	b //= 10
if x % 4 == 0:
	print(a)
else:
	while x % 4 != 0:
		a += 1
		x = 0
		b = a
		while b > 0:
			x += b % 10
			b //= 10
	print(a)


def check(n):
	res = 0
	while n != 0:
		res = res + n % 10
		n = n // 10
	if res % 4 == 0:
		return 1
	else:
		return 0
n = int(input())
while not check(n):
	n = n + 1
print(n)


a = int(input())
flag = 0

def sumdigits(a):
	sum = 0
	rem = 0
	while a != 0:
		rem = a % 10
		a = int(a / 10)
		sum = sum + rem
	return sum
while flag == 0:
	n = sumdigits(a)
	if n % 4 == 0:
		flag = 1
		print(a)
	else:
		a += 1


s = input()
a = int(s)

def check(x):
	suma = sum(map(int, str(x)))
	if suma % 4 == 0:
		return True
	else:
		return False
while True:
	if check(a):
		print(a)
		break
	else:
		a += 1


n = int(input())

def sum(x):
	res = 0
	while x > 0:
		res += x % 10
		x = int(x / 10)
	return res
while sum(n) % 4 != 0:
	n += 1
print(n)


def sum_dig(n):
	ans = 0
	while n > 0:
		r = n % 10
		n = int(n / 10)
		ans = (ans + r) % 4
	return ans == 0
n = int(input())
while True:
	if sum_dig(n):
		print(n)
		break
	n += 1


def check(x):
	sum = 0
	while x > 0:
		sum += x % 10
		x //= 10
	return sum
a = int(input())
while check(a) % 4 != 0:
	a += 1
print(a)


import sys
save = [False for _ in range(2001)]
for i in range(2001):
	if sum([int(i) for i in str(i)]) % 4 == 0:
		save[i] = True
n = int(sys.stdin.readline())
if save[n]:
	print(n)
else:
	for i in range(n, 2001):
		if save[i]:
			print(i)
			sys.exit()


import sys
import math
import bisect

def query_digit_sum(n):
	ans = 0
	while n:
		ans += n % 10
		n //= 10
	return ans

def main():
	n = int(input())
	while query_digit_sum(n) % 4:
		n += 1
	print(n)
main()


n = input()
while True:
	n = str(n)
	p = list(n)
	L = list(map(int, p))
	s = sum(L)
	if s % 4 == 0:
		print(int(n))
		break
	else:
		n = int(n) + 1


n = int(input())
for i in range(n, n + 1000):
	s = str(i)
	summ = 0
	for c in s:
		summ += ord(c) - ord('0')
	if summ % 4 == 0:
		print(i)
		return


n = input()
n_int = int(n)
digitsum = 0
for i in n:
	digitsum += int(i)
while digitsum % 4 != 0:
	n_int += 1
	n = str(n_int)
	digitsum = 0
	for i in n:
		digitsum += int(i)
print(n_int)


def f(n):
	s = str(n)
	count = 0
	for i in s:
		count += int(i)
	return count
n = int(input())
for i in range(n, n + 10):
	if f(i) % 4 == 0:
		print(i)
		exit(0)


def sumn(n):
	sumd = 0
	while n != 0:
		sumd = sumd + n % 10
		n = n // 10
	return sumd
N = int(input())
while sumn(N) % 4 != 0:
	N = N + 1
print(N)


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def digit_sum(n):
	ans = 0
	while n > 0:
		ans += n % 10
		n //= 10
	return ans
N = INT()
for i in range(N, 1007):
	if digit_sum(i) % 4 == 0:
		print(i)
		exit()


def sumd(n):
	s = 0
	while n > 0:
		rem = n % 10
		s += rem
		n = int(n / 10)
	return s
a = int(input())
while sumd(a) % 4 != 0:
	a += 1
print(a)


n = input()

def check(n):
	s = list(n)
	ans = 0
	for i in range(len(s)):
		ans += int(s[i])
	return ans
while True:
	ans = check(str(n))
	if ans % 4 == 0:
		break
	n = int(n) + 1
print(n)


a = int(input())
is_interesting = lambda x: sum((int(x) for x in str(a))) % 4 == 0
while True:
	if is_interesting(a):
		print(a)
		break
	a += 1


a = int(input())
flag = 0
n = a
while flag == 0:
	temp = n
	sum = 0
	while temp > 0:
		sum = sum + int(temp % 10)
		temp = int(temp / 10)
	if sum % 4 == 0:
		print(n)
		flag = 1
	n = n + 1


N = int(input())
ans = N
while True:
	d = [int(i) for i in str(ans)]
	if sum(d) % 4 == 0:
		print(ans)
		break
	ans += 1


def getSum(n):
	sum = 0
	while n > 0:
		sum += int(n % 10)
		n = int(n / 10)
	return sum
n = int(input())
flag = True
while flag:
	if getSum(n) % 4 == 0:
		print(n)
		flag = False
	else:
		n += 1


def Digitsum(n):
	tot = 0
	for i in str(n):
		tot += int(i)
	return tot
n = int(input())
m = int(Digitsum(n)) % 4
while m != 0:
	n += 1
	m = int(Digitsum(n)) % 4
print(n)


num = int(input())

def sum_digits(n):
	tot = 0
	while n > 0:
		dig = n % 10
		tot = tot + dig
		n = n // 10
	return tot
while sum_digits(num) % 4:
	num = num + 1
print(num)


n = int(input())

def sum(s):
	x = 0
	f = str(s)
	for c in f:
		x += int(c)
	if x % 4 == 0:
		return True
	else:
		return False
while 1 ^ sum(n):
	n += 1
print(n)


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = input()
while True:
	z = 0
	for i in n:
		z += int(i)
	if z % 4 == 0:
		print(n)
		break
	n = str(int(n) + 1)


from sys import stdin
n = int(stdin.readline().strip())
x1 = n
while True:
	x = list(str(x1))
	y = 0
	for i in x:
		y += int(i)
	if y % 4 == 0:
		break
	x1 += 1
print(x1)


a = int(input())

def sum_of_numbers(i):
	s = 0
	while i:
		s += i % 10
		i //= 10
	return s
d = -1
while d != 0:
	d = sum_of_numbers(a) % 4
	a += 1
print(a - 1)


import string
a = int(input())
s = 0
for i in list(str(a)):
	s += int(i)
while s % 4 != 0:
	a += 1
	s = 0
	for i in list(str(a)):
		s += int(i)
print(a)


from math import *
n = int(input())
s = 0
for i in str(n):
	s += int(i)
if s % 4 == 0:
	print(n)
	exit(0)
while 1:
	s = 0
	n = n + 1
	for i in str(n):
		s += int(i)
	if s % 4 == 0:
		print(n)
		break


x = int(input())

def check(x):
	temp = 0
	while x:
		temp += x % 10
		x = int(x / 10)
	if temp % 4 == 0:
		return True
	else:
		return False
while True:
	if check(x):
		print(x)
		break
	else:
		x += 1


def gh(a):
	if sum(map(int, str(a))) % 4:
		return gh(a + 1)
	else:
		return a
print(gh(int(input())))


def su(a):
	s = 0
	while a > 0:
		s += a % 10
		a = a // 10
	return s
a = int(input())
if su(a) % 4 == 0:
	print(a)
else:
	a += 1
	while True:
		if su(a) % 4 == 0:
			print(a)
			break
		a += 1


x = input()
m = []
for i in x:
	c = int(i)
	m.append(c)
while 1:
	s = sum(m)
	if s % 4 == 0:
		for i in m:
			print(i, end='')
		break
	x = int(x) + 1
	x = str(x)
	m = []
	for i in x:
		c = int(i)
		m.append(c)


from sys import stdin
import math

def add1(digits):
	carry = 1
	for i in range(4):
		digits[i] += carry
		if digits[i] == 10:
			digits[i] = 0
			carry = 1
		else:
			carry = 0
	return digits
m = int(input())
if m == 1000:
	print(1003)
else:
	n = m
	d3 = n // 1000
	n = n % 1000
	d2 = n // 100
	n = n % 100
	d1 = n // 10
	d0 = n % 10
	disp = 0
	dgts = [d0, d1, d2, d3]
	while disp < 7:
		sumDigits = sum(dgts)
		if sumDigits % 4 == 0:
			print(dgts[0] + dgts[1] * 10 + dgts[2] * 100 + dgts[3] * 1000)
			break
		else:
			dgts = add1(dgts)
		disp += 1


num = int(input())
n = num
sum_num = 1
while sum_num % 4 != 0:
	sum_num = 0
	n = num
	while n > 0:
		sum_num += n % 10
		n //= 10
	num += 1
num -= 1
print(num)


n = int(input())
l = list(map(int, str(n)))
s = sum(l)
if s % 4 == 0:
	print(n)
else:
	for i in range(1, 8):
		x = n + i
		a = list(map(int, str(x)))
		s = sum(a)
		if s % 4 == 0:
			print(x)
			break


a = input()

def finder(a):
	sum = 0
	for i in a:
		sum += int(i)
	if sum % 4 == 0:
		return a
	else:
		return finder(str(int(a) + 1))
print(finder(a))


num = int(input())
while sum([int(i) for i in list(str(num))]) % 4 != 0:
	num += 1
print(num)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)

def get(x):
	return sum(list(map(int, str(x))))
a = int(input())
while True:
	if get(a) % 4 == 0:
		print(a)
		exit()
	a += 1


a = str(int(input()))
b = 0
sum = 0
if int(a) == int(a) // 3 * 3 or int(a) >= 1:
	while b != 1:
		l = len(str(a))
		for q in range(l):
			sum += int(str(a)[q])
		if sum // 4 == sum / 4:
			print(a)
			b += 1
			break
		else:
			a = int(a) + 1
			sum = 0


n = int(input())

def degit_sum(n):
	return sum([int(e) for e in list(str(n))])
while degit_sum(n) % 4 != 0:
	n += 1
print(n)


a = input()
k = [int(i) for i in a]
while sum(k) % 4:
	a = str(int(a) + 1)
	k = [int(i) for i in a]
print(a)


a = int(input())

def add(num):
	num = str(num)
	ans = 0
	for i in num:
		ans += int(i)
	return ans
for i in range(a, 1010):
	tot = add(i)
	if tot % 4 == 0:
		print(i)
		break


def interesting(n):
	f = False
	sum = 0
	for i in n:
		sum += int(i)
	return sum % 4 == 0
a = int(input())
while not interesting(str(a)):
	a += 1
print(a)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(1):
	n = inin()
	for i in range(n, 1004):
		s = str(i)
		dig = [int(i) for i in s]
		if sum(dig) % 4 == 0:
			print(i)
			break


import sys

class Nearest:

	def ok(self, n):
		return sum((int(x) for x in str(n))) % 4 == 0

	def solve(self):
		a = int(input())
		n = a
		while 1:
			if self.ok(n):
				print(n)
				break
			n += 1
solver = Nearest()
input = sys.stdin.readline
solver.solve()


n = int(input())
s = 0
s = sum((int(digit) for digit in str(n)))
if s % 4 == 0:
	print(n)
else:
	for i in range(8):
		e = n + i
		s = sum((int(digit) for digit in str(e)))
		if s % 4 == 0:
			print(e)
			break


nu = int(input())
while True:
	n = str(nu)
	l = [int(i) for i in n]
	su = sum(l)
	if su % 4 == 0:
		print(*l, sep='')
		exit()
	else:
		nu += 1


def sum_of_digits(num):
	n_sum = 0
	while num > 0:
		n_sum += num % 10
		num //= 10
	return n_sum
a = int(input())
n = a
while sum_of_digits(n) % 4 != 0:
	n += 1
print(n)


t = input()
min1 = float('-inf')
while True:
	r = 0
	for i in range(len(t)):
		r = r + int(t[i])
	if r % 4 == 0:
		print(t)
		break
	r = int(t) + 1
	t = str(r)


def sumnum(num):
	add = 0
	while num > 0:
		a = num % 10
		num = num // 10
		add = add + a
	return add
n = int(input())
add = sumnum(n)
if add % 4 == 0:
	print(n)
else:
	for i in range(n, 2000):
		no = sumnum(i)
		if no % 4 == 0:
			break
	print(i)


n = input()
l = []
for i in n:
	l.append(int(i))
while sum(l) % 4 != 0:
	n = int(n) + 1
	n = str(n)
	l.clear()
	for i in n:
		l.append(int(i))
print(int(''.join(map(str, l))))


n = int(input())
sum = 0
while sum == 0 or sum % 4 != 0:
	sum = 0
	for i in list(str(n)):
		sum += int(i)
	if sum % 4 == 0:
		print(n)
	else:
		n += 1


def summ(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n = n // 10
	return ans
n = int(input())
while True:
	if summ(n) % 4 == 0:
		print(n)
		break
	else:
		n += 1


n = int(input())
s = 0
temp = n
while 1:
	while temp != 0:
		s += temp % 10
		temp = temp // 10
	if s % 4 == 0:
		print(n)
		break
	else:
		n += 1
		temp = n
		s = 0


num = str(input())

def sum(num):
	s = 0
	for i in num:
		s = s + int(i)
	return s
while True:
	summa = sum(num)
	if summa >= 4 and summa % 4 == 0:
		print(num)
		break
	else:
		num = str(int(num) + 1)


n = int(input())

def ct(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
while ct(n) % 4:
	n += 1
print(n)


def check(num):
	return sum(map(int, str(num))) % 4 == 0
a = int(input())
while not check(a):
	a += 1
print(a)


a = int(input())
while True:
	lst = list(str(a))
	result = 0
	for i in lst:
		result += int(i)
	if result % 4 == 0:
		print(a)
		break
	else:
		a += 1


def digitsum(n):
	n = list(map(int, str(n)))
	if sum(n) % 4 == 0:
		return True
	else:
		return False
n = int(input())
for i in range(n, n + 10):
	if digitsum(i):
		print(i)
		break


a = int(input())
ls = [100 * j + 10 * k + l for j in range(0, 10) for k in range(0, 10) for l in range(0, 10) if (j + k + l) % 4 == 0]
ls.append(1003)
for i in ls:
	if i >= a:
		print(i)
		break


def getSum(n):
	sum = 0
	while n != 0:
		sum = sum + int(n % 10)
		n = int(n / 10)
	return sum
s = int(input())
while getSum(s) % 4 != 0:
	s = s + 1
print(s)


def summ(n):
	l = len(str(n))
	t = 0
	for i in range(l - 1):
		t += n // 10 ** (i + 1) % 10
	t += n % 10
	if t % 4 == 0:
		return 1
	return 0
n = int(input())
x = 0
while summ(n) == x:
	n += 1
print(n)


n = int(input())
tmp = list(map(int, str(n)))
while sum(tmp) % 4 != 0:
	n += 1
	tmp = list(map(int, str(n)))
tmp = list(map(str, tmp))
print(''.join(tmp))


n = input()
c = 0
while 1:
	a = list(n)
	c = 0
	for i in range(len(a)):
		c += int(a[i])
	if c % 4 == 0:
		print(n)
		exit()
	else:
		n = str(int(n) + 1)


n = input()
r = int(n)
s = sum([int(i) for i in ' '.join(n).split()])
while s % 4 != 0:
	r += 1
	n = str(r)
	s = sum([int(i) for i in ' '.join(n).split()])
print(r)


def get_digit_sum(num):
	res = 0
	for i in num:
		res += int(i)
	return res
n = input()
while True:
	if get_digit_sum(n) % 4 == 0:
		print(n)
		break
	n = str(int(n) + 1)


def digits(number):
	sum1 = 0
	number = str(number)
	for char in number:
		sum1 += int(char)
	return sum1
n = int(input())
while True:
	if digits(n) % 4 == 0:
		print(n)
		break
	else:
		n += 1


I = lambda : int(input())
ID = lambda : map(int, input().split())
IL = lambda : list(ID())
a = I()
arr = map(int, str(a))
while sum(arr) % 4 != 0:
	a += 1
	arr = map(int, str(a))
print(a)


x = input()
x1 = int(x)

def su(x):
	x = str(x)
	y = list(x)
	for i in range(len(y)):
		y[i] = int(y[i])
	return sum(y)
md = su(x1) % 4
if su(x1) % 4 == 0:
	print(x1)
else:
	while True:
		if su(x1) % 4 == 0:
			print(x1)
			break
		else:
			x1 = x1 + 1


a = int(input())
l_a = [int(x) for x in str(a)]
s_a = sum(l_a)
if s_a % 4 == 0:
	print(a)
else:
	c = 0
	while s_a % 4 != 0:
		a += 1
		l_a = [int(x) for x in str(a)]
		s_a = sum(l_a)
		c += 1
	print(a)


n = int(input())
for i in range(n, 3000):
	r = i % 10
	m = i
	s = 0
	while i > 0:
		r = i % 10
		s = s + r
		i = i // 10
	if s % 4 == 0:
		print(m)
		break


def sumd(a):
	x = 0
	for y in a:
		x += int(y)
	return x
a = input()
x = 0
while sumd(a) % 4 != 0:
	a = str(int(a) + 1)
print(a)


n = int(input())
s = 0
for i in range(n, n + 10):
	k = i
	while i != 0:
		s += i % 10
		i //= 10
	if s % 4 == 0:
		print(k)
		break
	else:
		s = 0


n = int(input())
for i in range(1003):
	u = list(str(n))
	t = map(int, u)
	if sum(t) % 4 == 0:
		print(n)
		break
	else:
		n += 1


a = int(input())
while 1 == 1:
	b = list(str(a))
	c = 0
	for i in b:
		c += int(i)
	if c % 4 == 0:
		break
	a += 1
print(a)


n = int(input())

def cal(num):
	sum = 0
	while num > 0:
		d = num % 10
		num = num // 10
		sum += d
	return sum
while True:
	if cal(n) % 4 == 0:
		print(n)
		break
	else:
		n += 1


a = int(input())
i = a
while True:
	x = str(i)
	y = [int(j) for j in x]
	if sum(y) % 4 == 0:
		print(i)
		break
	else:
		i += 1


n = int(input())

def sum(t):
	sum = 0
	while t != 0:
		sum = sum + t % 10
		t = t // 10
	return sum
for i in range(n, n + 10):
	if sum(i) % 4 == 0:
		print(i)
		exit()


num = 0
a = b = int(input())
while True:
	bList = list(str(b))
	for i in range(0, len(bList)):
		num += int(bList[i])
	if num % 4 == 0:
		print(b)
		break
	else:
		num = 0
		b += 1


def sum_of_digits(n):
	sum = 0
	while n != 0:
		sum += n % 10
		n = n // 10
	return sum

def interesting_number(n):
	if sum_of_digits(n) % 4 == 0:
		return n
	else:
		return interesting_number(n + 1)
a = int(input())
print(interesting_number(a))


n = int(input())
x = n
while True:
	sum = 0
	while n != 0:
		rem = n % 10
		sum = sum + rem
		n = n // 10
	if sum % 4 == 0:
		print(x)
		break
	x = x + 1
	n = x


def inter(n):
	sum = 0
	for i in n:
		sum += int(i)
	return sum
a = input()
if inter(a) % 4 == 0:
	print(a)
else:
	at = int(a)
	while True:
		at += 1
		if inter(str(at)) % 4 == 0:
			print(at)
			break


t = input()
s = 0
for x in t:
	s += int(x)
if s % 4 == 0:
	print(t)
else:
	perfect = s // 4 + 1
	value = perfect * 4
	dif = value - s
	if int(t[-1]) + dif <= 9:
		print(int(t) + dif)
	else:
		t = int(t)
		t = t // 10
		t += 1
		t = t * 10
		new_sum = 0
		for d in str(t):
			new_sum += int(d)
		if new_sum % 4 == 0:
			print(t)
		else:
			perfect2 = new_sum // 4 + 1
			dif2 = perfect2 * 4 - new_sum
			t += dif2
			print(t)


a = input()

def interesting_function(x):
	while True:
		sum_of_digits = 0
		for n in x:
			sum_of_digits += int(n)
		if sum_of_digits % 4 == 0:
			return int(x)
			break
		x = int(x)
		x += 1
		x = str(x)
print(interesting_function(a))


n = input()

def sum_digits(l):
	m = list(str(l))
	sum = 0
	arr = []
	arr.extend(m)
	for i in arr:
		sum = sum + int(i)
	return sum
if sum_digits(n) % 4 == 0:
	print(n)
elif sum_digits(int(n) + 1) % 4 == 0:
	print(int(n) + 1)
elif sum_digits(int(n) + 2) % 4 == 0:
	print(int(n) + 2)
elif sum_digits(int(n) + 3) % 4 == 0:
	print(int(n) + 3)
elif sum_digits(int(n) + 4) % 4 == 0:
	print(int(n) + 4)
elif sum_digits(int(n) + 5) % 4 == 0:
	print(int(n) + 5)
elif sum_digits(int(n) + 6) % 4 == 0:
	print(int(n) + 6)
elif sum_digits(int(n) + 7) % 4 == 0:
	print(int(n) + 7)


t = input()
while sum(map(int, t)) % 4 != 0:
	t = str(int(t) + 1)
print(t)


def n_i_n(x):
	strx = str(x)
	str_list = [int(num) for num in strx]
	num_sum = sum(str_list)
	if num_sum % 4 == 0:
		return x
	else:
		while num_sum % 4 != 0:
			x += 1
			strx = str(x)
			str_list = [int(num) for num in strx]
			num_sum = sum(str_list)
		return x
x = int(input())
print(n_i_n(x))


def myfn(a):
	sum = 0
	while a != 0:
		sum = sum + a % 10
		a = a // 10
	return sum
n = int(input())
sum = 0
while 1:
	if myfn(n) % 4 == 0:
		print(n)
		break
	else:
		n += 1


def digits(num):
	sum = 0
	while num != 0:
		sum += num % 10
		num //= 10
	return sum
a = int(input())
while True:
	l = digits(a)
	if l % 4 == 0:
		n = a
		break
	a += 1
print(n)


a = int(input())
for i in range(a, 1200):
	f = str(i)
	E = 0
	for j in f:
		E += int(j)
	if E % 4 == 0:
		print(i)
		break


def add(n):
	c = 0
	l = 0
	while l != 1:
		m = [int(i) for i in str(n)]
		for i in range(len(m)):
			c += m[i]
		if c % 4 != 0:
			n += 1
			l = 0
		if c % 4 == 0:
			return n
		c = 0
n = int(input())
print(add(n))


a = map(int, input())
a = list(a)
s = 0
for i in range(len(a)):
	s = s + a[i]
if s % 4 == 0:
	print(''.join(map(str, a)))
else:
	while s % 4 != 0:
		a = ''.join(map(str, a))
		a = int(a)
		a = a + 1
		a = map(int, str(a))
		a = list(a)
		s = 0
		for i in range(len(a)):
			s = s + a[i]
	print(''.join(map(str, a)))


def is_interesting(s):
	return sum([int(i) for i in s])
s = input()
while is_interesting(s) % 4 != 0:
	s = str(int(s) + 1)
print(s)


n = input()
a = 0
while True:
	for char in n:
		a += int(char)
	if a % 4 == 0:
		break
	n = str(int(n) + 1)
	a = 0
print(n)


def cal(n):
	d = str(n)
	sum = 0
	for i in d:
		sum += int(i)
	return sum
x = int(input())
sum = 0
for i in range(x, 2000):
	if cal(i) % 4 == 0:
		print(i)
		break


def f(a):
	s = 0
	for i in a:
		s += int(i)
	if s % 4 == 0:
		return False
	return True
s = input()
while f(s):
	s = str(int(s) + 1)
print(s)


def Summa(number):
	temp = number
	sum = 0
	while temp != 0:
		sum += temp % 10
		temp //= 10
	return sum
input = int(input())
temp = input
while Summa(temp) % 4 != 0:
	temp += 1
print(temp)


def nearest(n):
	(i, z) = (n, True)
	while i <= n + 100 and z:
		j = i
		s = []
		while j > 0:
			s.append(j % 10)
			j = j // 10
		if sum(s) % 4 == 0:
			return i
		else:
			i += 1
n = int(input())
print(nearest(n))


def f(b):
	cnt = 0
	while b != 0:
		cnt += b % 10
		b //= 10
	return cnt
a = int(input())
while f(a) % 4 != 0:
	a += 1
print(a)


n = int(input())
for i in range(n, 100000):
	s = sum(map(int, list(str(i))))
	if s % 4 == 0:
		print(i)
		break


def check(a):
	s = 0
	for char in str(a):
		s += int(char)
	if s % 4 == 0:
		return True
	return False
n = int(input())
while not check(n):
	n += 1
print(n)


l = int(input())
while 1:
	s = str(l)
	p = list(map(int, s))
	su = sum(p)
	if su % 4 == 0:
		break
	l += 1
print(l)


a = int(input())
while True:
	a = str(a)
	t = 0
	for e in a:
		t += int(e)
	if t % 4 == 0:
		print(a)
		break
	a = int(a)
	a += 1


def data(a):
	da = 0
	while a != 0:
		da = da + a % 10
		a = int(a / 10)
	return da
a = int(input())
for x in range(a, 1100):
	if data(x) % 4 == 0:
		print(x)
		break


n = int(input())
c = 1
while c:
	v = n
	s = 0
	while v:
		s += v % 10
		v = v // 10
	if s % 4 == 0:
		c = 0
	else:
		n += 1
print(n)


i = int(input())
while sum(map(int, list(str(i)))) % 4 != 0:
	i = i + 1
print(i)


import sys
N = int(sys.stdin.readline())
while True:
	if sum([int(x) for x in str(N)]) % 4 == 0:
		print(N)
		break
	else:
		N += 1


a = int(input())
if a == 1000:
	print(1003)
else:
	c = a % 10 + a // 10 % 10 + a // 100 % 10 + a // 1000 % 10
	while c % 4 != 0:
		a = a + 1
		c = a % 10 + a // 10 % 10 + a // 100 % 10 + a // 1000 % 10
	print(a)


def digisum(n):
	k = 0
	t = n
	while t > 0:
		k += t % 10
		t //= 10
	return k
n = int(input())
i = -1
while True:
	i += 1
	if digisum(n + i) % 4 == 0:
		print(n + i)
		break


A = int(input())
while sum([int(x) for x in str(A)]) % 4 != 0:
	A += 1
print(A)


func = lambda x: not sum(map(int, str(x))) % 4
a = int(input())
while not func(a):
	a += 1
print(a)


def call(n):
	temp = n
	n = list(str(n))
	count = 0
	for i in n:
		count = count + int(i)
	if count % 4 == 0:
		str1 = ''.join(n)
		print(str1)
	else:
		temp = temp + 1
		call(temp)
n = int(input())
sum = call(n)


a = int(input())
while 1:
	su = 0
	num = a
	while num:
		su += num % 10
		num //= 10
	if su % 4 == 0:
		print(a)
		break
	a += 1


n = int(input())
while (n // 1000 + n // 100 % 10 + n % 100 // 10 + n % 10) % 4 != 0:
	n += 1
print(n)


n = input()
nlist = list(n)
for i in range(0, len(nlist)):
	nlist[i] = int(nlist[i])
listsum = sum(nlist)
while listsum % 4 != 0:
	n = int(n) + 1
	nlist = list(str(n))
	for i in range(0, len(nlist)):
		nlist[i] = int(nlist[i])
	listsum = sum(nlist)
print(n)


import sys
a = int(sys.stdin.readline())
res = a
while True:
	if res >= 1 and res < 10:
		if res % 4 == 0:
			print(res)
			break
	elif res >= 10 and res < 100:
		if (res // 10 + res % 10) % 4 == 0:
			print(res)
			break
	elif res >= 100 and res < 1000:
		if (res // 100 + res % 100 // 10 + res % 10) % 4 == 0:
			print(res)
			break
	elif res >= 1000:
		if (res // 1000 + res % 1000 // 100 + res % 100 // 10 + res % 10) % 4 == 0:
			print(res)
			break
	res += 1


n = list(input())
no = int(''.join(n))
l = list(map(int, n))
s = sum(l)
if s % 4 == 0:
	print(''.join(n))
elif l[-1] >= 7:
	while sum(list(map(int, list(str(no))))) % 4 != 0:
		no += 1
	print(no)
else:
	print(s // 4 * 4 + 4 - s + no)


import sys
from itertools import count

def main():
	for n in count(int(sys.stdin.read().strip())):
		if not sum(map(int, str(n))) % 4:
			return n
print(main())


m = input()
n = list(m)
n = [int(i) for i in n]
s = sum(n)
if s % 4 == 0:
	print(m)
else:
	x = int(m)
	while True:
		n = list(str(x))
		n = [int(i) for i in n]
		s = sum(n)
		if s % 4 == 0:
			print(x)
			break
		else:
			x += 1


n = int(input())
for i in range(n, n + 10):
	arr = list(map(int, str(i)))
	if sum(arr) % 4 == 0:
		print(i)
		break


from sys import stdin, stdout

def sumstr(a):
	k = 0
	for i in range(len(a)):
		k += int(a[i])
	return k
a = int(stdin.readline().rstrip())
while True:
	n = sumstr(str(a))
	if n % 4 == 0:
		break
	else:
		a += 1
stdout.write(str(a) + '\n')


def inter(n):
	m = 0
	while n != 0:
		m = m + n % 10
		n = n // 10
	if m % 4 == 0:
		return True
x = int(input())
if inter(x) == True:
	print(x)
else:
	while True:
		x = x + 1
		if inter(x) == True:
			print(x)
			break


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	while True:
		s = str(n)
		ans = 0
		for x in s:
			ans += int(x)
		if ans % 4 == 0:
			return s
		n += 1
print(main())


def scan(num):
	sch = 0
	num = str(num)
	for i in num:
		sch += int(i)
	if sch % 4 != 0:
		return True
	else:
		return False
n = int(input())
while scan(n):
	n += 1
print(n)


def sm(x):
	s = 0
	while x > 0:
		s += x % 10
		x //= 10
	return s % 4 == 0

def bliz(x):
	tc1 = x
	tc2 = x
	while not sm(tc1):
		tc1 += 1
	return tc1
n = int(input())
print(bliz(n))


def summa(a):
	sum = 0
	for i in range(len(a)):
		sum += int(a[i])
	return sum

def funct(a):
	if summa(a) % 4 != 0:
		a = int(a) + 1
		a = str(a)
		funct(a)
	else:
		print(a)
		return a
a = input()
s = funct(a)


a = int(input())
s = x = j = int(0)
p = str(a)
b = len(p)
while x < b:
	s = s + int(p[x])
	x = x + 1
while s % 4 != 0:
	p = str(a)
	b = len(p)
	x = s = int(0)
	while x < b:
		s = s + int(p[x])
		x = x + 1
	a = a + 1
	j = 1
print(a - 1 if j == 1 else a)


n = int(input())

def sum(n):
	total = 0
	while n != 0:
		total += n % 10
		n = int(n / 10)
	return total
while True:
	if sum(n) % 4 == 0:
		print(n)
		exit()
	n += 1


n = int(input())

def digits_div_by_4(num):
	dig = sum(list(map(int, list(str(num)))))
	return dig % 4 == 0
while True:
	if digits_div_by_4(n):
		print(n)
		break
	else:
		n += 1


def fun(n):
	s = 0
	while n:
		s += n % 10
		n = n // 10
	return s
t = int(input())
while fun(t) % 4 != 0:
	t += 1
print(t)


n = int(input())
while True:
	if sum(map(int, str(n))) % 4 == 0:
		print(n)
		exit()
	n += 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
ans = n
for s in range(n, n + 1000):
	num = str(s)
	count = 0
	for i in num:
		count += int(i)
	if count % 4 == 0:
		ans = num
		break
print(ans)


a = int(input())
while 1:
	summa = 0
	for i in range(len(str(a))):
		summa += int(str(a)[i])
	if summa % 4 == 0:
		print(a)
		break
	a += 1


def is_dev4(n):
	s = sum([int(v) for v in n])
	return s % 4 == 0
a = int(input())
for i in range(a, (a + 1) * 4):
	if is_dev4(str(i)):
		print(i)
		break


x = input()
z = 0
e = 0
n = True
while n == True:
	while z < len(x):
		e += int(x[z])
		z += 1
	if e % 4 == 0:
		print(x)
		exit()
	else:
		x = int(x) + 1
		x = str(x)
		z = 0
		e = 0


import sys
import os
from io import IOBase, BytesIO

def string_sum(s):
	total = 0
	for i in s:
		total += int(i)
	return total

def main():
	s = input()
	total = string_sum(s)
	if total % 4 == 0:
		print(s)
		return
	while total % 4 != 0:
		tmp = int(s)
		tmp += 1
		s = str(tmp)
		total = string_sum(s)
	print(s)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()
main()


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
string = get_string()
n = int(string)
s = sum(list(map(int, list(string))))
flag = True
while flag:
	if s % 4 == 0:
		flag = False
		print(string)
	else:
		n += 1
		string = str(n)
		s = sum(list(map(int, list(string))))


a = input()
b = int(a)

def sm(r):
	sum = 0
	for i in range(len(r)):
		sum = sum + int(r[i])
	return sum
while sm(a) % 4 != 0:
	b = b + 1
	a = str(b)
print(a)


def sum_digit(num):
	digit = 0
	for i in range(len(num)):
		digit = digit + int(num[i])
	return digit
num = input()
digit = sum_digit(num)
while digit % 4 != 0:
	num = int(num) + 1
	digit = sum_digit(str(num))
print(num)


la = [4, 8, 13, 17, 22, 26, 31, 35, 39, 40, 44, 48, 53, 57, 62, 66, 71, 75, 79, 80, 84, 88, 93, 97, 4, 8, 13, 17, 22, 26, 31, 35, 39, 40, 44, 48, 53, 57, 62, 66, 71, 75, 79, 80, 84, 88, 93, 97, 103, 107, 112, 116, 121, 125, 129, 130, 134, 138, 143, 147, 152, 156, 161, 165, 169, 170, 174, 178, 183, 187, 192, 196, 202, 206, 211, 215, 219, 220, 224, 228, 233, 237, 242, 246, 251, 255, 259, 260, 264, 268, 273, 277, 282, 286, 291, 295, 299, 301, 305, 309, 310, 314, 318, 323, 327, 332, 336, 341, 345, 349, 350, 354, 358, 363, 367, 372, 376, 381, 385, 389, 390, 394, 398, 400, 404, 408, 413, 417, 422, 426, 431, 435, 439, 440, 444, 448, 453, 457, 462, 466, 471, 475, 479, 480, 484, 488, 493, 497, 503, 507, 512, 516, 521, 525, 529, 530, 534, 538, 543, 547, 552, 556, 561, 565, 569, 570, 574, 578, 583, 587, 592, 596, 602, 606, 611, 615, 619, 620, 624, 628, 633, 637, 642, 646, 651, 655, 659, 660, 664, 668, 673, 677, 682, 686, 691, 695, 699, 701, 705, 709, 710, 714, 718, 723, 727, 732, 736, 741, 745, 749, 750, 754, 758, 763, 767, 772, 776, 781, 785, 789, 790, 794, 798, 800, 804, 808, 813, 817, 822, 826, 831, 835, 839, 840, 844, 848, 853, 857, 862, 866, 871, 875, 879, 880, 884, 888, 893, 897, 903, 907, 912, 916, 921, 925, 929, 930, 934, 938, 943, 947, 952, 956, 961, 965, 969, 970, 974, 978, 983, 987, 992, 996, 1003]
a = int(input())
while la[0] < a:
	del la[0]
print(la[0])


def good(n):
	return sum((int(c) for c in str(n))) % 4 == 0
n = int(input())
while not good(n):
	n += 1
print(n)


n = int(input())
answer = 0
while True:
	currAnswer = 0
	for i in str(n):
		currAnswer += int(i)
	if currAnswer % 4 == 0:
		answer = n
		break
	else:
		n += 1
print(answer)


def cif(n):
	n = str(n)
	s = 0
	for i in n:
		s += int(i)
	return s % 4
a = int(input())
flag = True
while flag:
	if cif(a) == 0:
		flag = False
	else:
		a += 1
print(a)


def check(cl):
	summ = 0
	ci = cl
	while ci != 0:
		remainder = ci % 10
		summ += remainder
		ci = ci // 10
	if summ % 4 == 0:
		print(cl)
		return True
	else:
		return False
n = int(input())
while True:
	if check(n):
		break
	else:
		n += 1


x = input()
i = int(x)
while True:
	x = str(i)
	sum = 0
	for num in x:
		sum += int(num)
	if sum % 4 == 0:
		print(i)
		break
	i += 1


def getSum(n):
	sum = 0
	while n != 0:
		sum = sum + int(n % 10)
		n = int(n / 10)
	return sum
a = int(input())
l = []
for i in range(a, 100000):
	ans = getSum(i)
	if ans % 4 == 0:
		l.append(i)
		break
print(*l)


def sumDigits(n):
	return 0 if n == 0 else n % 10 + sumDigits(n // 10)
n = int(input())
x = sumDigits(n)
while x % 4:
	n += 1
	x = sumDigits(n)
print(n)


def digitsum(num):
	sum = 0
	while num > 0:
		sum = sum + num % 10
		num = num // 10
	return sum

def interesting(num):
	return digitsum(num) % 4 == 0
num = int(input())
while not interesting(num):
	num = num + 1
print(num)


n = list(input())
sum = 0
while 6 == 6:
	for it in n:
		sum += int(it)
	if sum % 4 == 0:
		break
	else:
		n = ''.join(n)
		n = int(n)
		n += 1
		n = list(str(n))
	sum = 0
print(''.join(n))


def fx(x):
	sum = 0
	while x != 0:
		rem = x % 10
		sum = sum + rem
		x = x // 10
	return sum
a = int(input())
sum = fx(a)
if sum % 4 == 0:
	print(a)
else:
	while sum % 4 != 0:
		a += 1
		sum = fx(a)
	print(a)


def interesting(x):
	sum = 0
	for i in str(x):
		sum += int(i)
	if sum % 4 == 0:
		return 1
	return 0
t = int(input())
while interesting(t) == 0:
	t += 1
print(t)


def is_interesting(n):
	d = 0
	while n > 0:
		d += n % 10
		n //= 10
	return d % 4 == 0
n = int(input())
while not is_interesting(n):
	n += 1
print(n)


def sumdigi(n):
	s = 0
	while n:
		s += n % 10
		n = n // 10
	return s
n = int(input())
ans = 0
for i in range(n, 1100):
	if sumdigi(i) % 4 == 0:
		ans = i
		break
print(ans)


n = int(input())
for i in range(n, 1005):
	sum = 0
	t = str(i)
	for i in t:
		i = int(i)
		sum = sum + i
	if sum % 4 == 0:
		print(t)
		break


def sum_of_numbers(s):
	s = list(map(int, str(s)))
	ans = 0
	for i in range(len(s)):
		ans += s[i]
	return ans
s = int(input())
k = list(map(int, str(s)))
while sum_of_numbers(s) % 4 != 0:
	s += 1
print(s)


def summ(n):
	m = 0
	s = 0
	while n != 0:
		m = n % 10
		s += m
		n //= 10
	return s

def nearNum(n):
	sn = summ(n)
	while sn % 4 != 0:
		n += 1
		sn = summ(n)
	return n
n = int(input())
print(nearNum(n))


def su(n):
	c = [0] * (n + 1)
	while n != 0:
		a = n % 10
		n = n // 10
		c.append(a)
	return sum(c)
n = int(input())
if su(n) % 4 == 0:
	print(n)
else:
	for i in range(1, 9):
		if su(n + i) % 4 == 0:
			print(n + i)
			break


a = int(input())
while True:
	b = list(str(a))
	sum_ = 0
	for x in b:
		sum_ += int(x)
	if sum_ % 4 == 0:
		break
	a += 1
print(''.join(b))


def summ(num):
	ans = 0
	for i in range(len(num)):
		ans += int(num[i])
	return ans
num = input()
for i in range(int(num), 1004):
	if summ(str(i)) % 4 == 0:
		print(i)
		break


from sys import stdin

def verifcar(n):
	ans = n
	j = 0
	while ans != 0:
		j += ans % 10
		ans = ans // 10
	return j

def main():
	n = int(stdin.readline().strip())
	while verifcar(n) % 4 != 0:
		n += 1
	print(n)
main()


a = int(input())
n = a
s = 0

def sum1(n):
	s = 0
	while n > 0:
		r = int(n % 10)
		s = s + r
		n = n / 10
	return s
while n:
	r = int(n % 10)
	s = s + r
	n = n / 10
if s % 4 == 0:
	print(a)
else:
	while s % 4 != 0:
		a = a + 1
		s = sum1(a)
	print(a)


s = input()
a = int(s)
tong = 0
for i in range(0, len(s)):
	tong = tong + int(s[i])
while tong % 4 != 0:
	tong = 0
	a = a + 1
	s = str(a)
	tong = 0
	for i in range(0, len(s)):
		tong = tong + int(s[i])
print(a)


def s(n):
	n = str(n)
	t = 0
	for i in n:
		t = t + int(i)
	return t
n = input()
while True:
	su = s(n)
	n = int(n)
	if su % 4 == 0:
		print(n)
		break
	else:
		n = n + 1


n = input()
while True:
	digits = [int(digit) for digit in n]
	add = sum(digits)
	if add % 4 == 0:
		print(n)
		break
	else:
		n = str(int(n) + 1)


m = list(map(int, input()))
a = sum(m)
if sum(m) % 4 == 0:
	print(int(''.join(map(str, m))))
else:
	num = int(''.join(map(str, m)))
	while a % 4 != 0:
		num = num + 1
		lst = list(map(int, str(num)))
		a = sum(lst)
	print(num)


def digitSum(n):
	ans = 0
	while n:
		ans += n % 10
		n //= 10
	return ans
a = int(input())
if digitSum(a) % 4 == 0:
	print(a)
else:
	while digitSum(a) % 4 != 0:
		a += 1
	print(a)


def sum(n):
	summ = 0
	for i in n:
		summ += int(i)
	return summ
n = int(input())
while sum(str(n)) % 4 != 0:
	n += 1
print(n)


a = int(input())
i = a
while True:
	s = 0
	t = i
	while t != 0:
		s += t % 10
		t //= 10
	if s % 4 == 0:
		print(i)
		break
	i += 1


a = int(input())
while sum(list(map(int, list(str(a))))) % 4:
	a += 1
print(a)


def sum(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	return s
a = int(input())
i = a
while i >= a:
	if sum(i) % 4 == 0:
		print(i)
		break
	i += 1


n = input()
z = int(n)
sum = 0
for i in range(len(n)):
	sum = sum + int(n[i])
if sum % 4 == 0:
	f = z
else:
	while 1:
		z = z + 1
		sum = 0
		for i in range(len(str(z))):
			o = str(z)
			sum = sum + int(o[i])
		if sum % 4 == 0:
			f = z
			break
print(f)


def sum(n):
	(su, rem) = (0, 0)
	while n != 0:
		rem = n % 10
		su = su + rem
		n = n // 10
	return su
n = int(input())
while sum(n) % 4 != 0:
	n += 1
print(n)


from sys import stdin
from math import *

def main():
	strN = stdin.readline().strip()
	sumaN = sum([int(x) for x in list(strN)])
	if sumaN % 4 == 0:
		print(strN)
	else:
		i = int(strN)
		while 1:
			string = str(i + 1)
			r = sum([int(x) for x in list(string)])
			if r % 4 == 0:
				print(string)
				break
			i += 1
main()


n = int(input())
for i in range(n, n + 11):
	k = i
	ans = 0
	while k > 0:
		ans += k % 10
		k //= 10
	if ans % 4 == 0:
		print(i)
		break


n = input()
while True:
	sumOfDigits = sum([int(i) for i in n])
	if sumOfDigits % 4 == 0:
		print('{}'.format(n))
		break
	n = str(int(n) + 1)


from math import *
from itertools import *
from collections import *
from bisect import *

def interesting(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s % 4 == 0
n = int(input())
while not interesting(n):
	n += 1
print(n)


def digsum(n):
	sm = 0
	while n:
		sm += n % 10
		n //= 10
	return sm
n = int(input())
while digsum(n) % 4:
	n += 1
print(n)


k = input()
while True:
	g = 0
	for x in k:
		g += int(x)
	if g % 4 == 0:
		break
	else:
		k = str(int(k) + 1)
print(k)


t = input()
sum = 0
for i in t:
	y = int(i)
	sum += y
s = int(t)
while sum % 4 != 0:
	s += 1
	e = str(s)
	sum = 0
	for j in e:
		z = int(j)
		sum += z
print(s)


n = int(input())
s = 1
while s % 4 != 0:
	t = str(n)
	t = list(t)
	s = 0
	for i in range(len(t)):
		s = s + int(t[i])
	n = n + 1
print(n - 1)


a = int(input())
res = 0
while res == 0:
	l = list(map(int, list(str(a))))
	if sum(l) % 4 == 0:
		res = a
		break
	a += 1
print(res)


def interest(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	if s % 4 == 0:
		return True
	else:
		return False
x = int(input())
for i in range(x, 1004):
	if interest(i):
		print(i)
		break


from sys import *
from math import *
a = int(input())
x = list(map(int, str(a)))
while 1:
	if sum(x) % 4 == 0:
		break
	a += 1
	x = list(map(int, str(a)))
print(a)


n = input()
res = []

def test(n):
	n = str(n)
	nParts = []
	for i in range(len(n)):
		nParts.append(int(n[i]))
	nSomme = 0
	for i in range(len(nParts)):
		nSomme += nParts[i]
	if nSomme % 4 == 0:
		lene = len(nParts)
		res.append(lene)
		res.append(n)
		return res
	else:
		n = int(n)
		test(n + 1)
dd = test(n)
print(res[1])


a = input()

def sumOFNumber(x):
	return sum(list(map(int, list(a))))
while sumOFNumber(a) % 4 != 0:
	a = str(int(a) + 1)
print(a)


N = input()
g = lambda x: sum([int(i) for i in x])
if g(N) % 4 == 0:
	print(int(N))
else:
	for i in range(int(N) + 1, 10003):
		if g(str(i)) % 4 == 0:
			print(i)
			break


def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
a = int(input())
while 1:
	c = sum_digits(a)
	if c % 4 == 0:
		print(a)
		exit(0)
	else:
		a += 1


def func(n):
	s = str(n)
	if sum((int(i) for i in s)) % 4 == 0:
		return True
	return False
n = int(input())
while not func(n):
	n += 1
print(n)


def sum1(n):
	sum2 = 0
	for i in n:
		sum2 = sum2 + int(i)
	return sum2
n = int(input())
while True:
	if sum1(str(n)) % 4 == 0:
		print(n)
		break
	n += 1


a = int(input())

def sumofdigits(a):
	sumd = 0
	for n in str(a):
		sumd += int(n)
	return sumd
sumdd = sumofdigits(a)
while sumdd % 4 != 0:
	a += 1
	sumdd = sumofdigits(a)
print(a)


def po(x):
	f = 0
	while x >= 1:
		f += x % 10
		x = x // 10
	return f
x = int(input())
while 1:
	if po(x) % 4 == 0:
		print(x)
		break
	else:
		x += 1


a = int(input())
c = [i for i in range(a, a + 10)]

def check(g):
	n = 0
	g = str(g)
	for i in g:
		n += int(i)
	return n
if check(a) % 4 != 0:
	for i in c:
		d = check(i)
		if d % 4 == 0:
			print(i)
			break
else:
	print(a)


data = int(input())
while True:
	count = 0
	for i in str(data):
		count += int(i)
	if count % 4 == 0:
		break
	data += 1
print(data)


n = int(input())

def sum_of_digs(temp):
	c = 0
	while temp > 0:
		a = temp % 10
		c += a
		temp = temp // 10
	return c % 4 == 0
for i in range(n, n + 11):
	if sum_of_digs(i):
		print(i)
		break


def cal(n):
	sum1 = 0
	while n > 0:
		sum1 += n % 10
		n = n // 10
	return sum1
t = int(input())
while cal(t) % 4 != 0:
	t += 1
print(t)


a = int(input())
while True:
	b = a
	summ = 0
	while a > 0:
		summ += a % 10
		a //= 10
	if not summ % 4:
		print(b)
		break
	a = b + 1


n = int(input())
while True:
	(a, s) = (str(n), 0)
	for x in a:
		s += int(x)
	if s % 4 == 0:
		print(a)
		break
	n = n + 1


a = int(input())

def dig_sum(x):
	if x == 0:
		return x
	return x % 10 + dig_sum(x // 10)
while True:
	if dig_sum(a) % 4 == 0:
		print(a)
		break
	a += 1


num = input()
while sum([int(s) for s in num]) % 4 != 0:
	num = str(int(num) + 1)
print(num)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
n = int(input())
sumOfDig = lambda N: int(reduce(lambda x, y: str(int(x) + int(y)), list(str(N))))
while sumOfDig(n) % 4:
	n += 1
print(n)


s = input()
n = int(s)

def func(s):
	st = 0
	for i in range(len(s)):
		st += int(s[i])
	return st
while True:
	if func(s) % 4 == 0:
		print(s)
		break
	else:
		n += 1
		s = str(n)


s0 = input()
s1 = sum((int(x) for x in s0))
a = 0
result = 0
for i in range(1001):
	a = int(s0) + i
	result = sum((int(x) for x in str(a)))
	if result % 4 == 0:
		print(int(s0) + i)
		break


import os
import heapq
import sys
import math
import bisect
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	n = int(input())
	while 1:
		st = str(n)
		sm = 0
		for i in range(len(st)):
			sm += int(st[i])
		if sm % 4 == 0:
			print(n)
			break
		else:
			n += 1
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


z = input()
r = int(z)
while True:
	w = str(r)
	s = 0
	for i in w:
		s += int(i)
	if s % 4 == 0:
		break
	r += 1
print(r)


def getSum(n):
	n = str(n)
	sum = 0
	for i in n:
		sum = sum + int(n[:1])
		n = n[1:]
	return sum
n = int(input())
while getSum(n) % 4 is not 0:
	n = n + 1
print(n)


a = int(input())
n = len(str(a))
lis = []
count = 0
for i in range(n):
	k = a % 10 ** (i + 1) // 10 ** i
	lis.append(k)
	count = count + k
while count % 4 != 0:
	a += 1
	n = len(str(a))
	count = 0
	lis = []
	for i in range(n):
		k = a % 10 ** (i + 1) // 10 ** i
		lis.append(k)
		count = count + k
print(a)


a = int(input())
n = a
while True:
	d_sum = sum(map(int, str(n))) % 4
	if d_sum == 0:
		print(n)
		break
	n += 1


def sumfind(x):
	sum1 = 0
	for i in x:
		sum1 += int(i)
	return str(sum1)
n = input()
s = sumfind(n)
while int(s) % 4 != 0:
	n = int(n) + 1
	s = sumfind(str(n))
print(int(n))


n = int(input())
k = n
while 1:
	m = k
	s = 0
	while m:
		s += m % 10
		m = m // 10
	if s % 4 == 0:
		break
	else:
		k += 1
print(k)


n = int(input())
while 1:
	sod = sum((int(i) for i in str(n)))
	if sod % 4 != 0:
		n += 1
	else:
		print(n)
		break


import io, os
import math
import heapq
import copy
from collections import OrderedDict
from collections import deque
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
mod = 1000000007

def powm(a, b):
	res = 1
	a %= mod
	while b:
		if b & 1:
			res = res * a % mod
		a = a * a % mod
		b >>= 1
	return res
k = input()
l = list(k)
n = int(k)
q = []
s = 0
for i in range(len(l)):
	s = s + int(l[i])
	q.append(int(l[i]))
if s % 4 == 0:
	print(int(k))
else:
	ans = n
	qq = 10000000
	while qq > 0:
		tot = 0
		ans = n
		while n > 0:
			dig = n % 10
			tot = tot + dig
			n = n // 10
		if tot % 4 == 0 and tot >= 4:
			break
		else:
			n = ans + 1
			ans = ans + 1
		qq = qq - 1
	print(ans)


def digSum(k):
	k = list(str(k))
	ans = 0
	for i in k:
		ans += int(i)
	return ans
n = int(input())
while digSum(n) % 4 != 0:
	n += 1
print(n)


def f(s):
	su = 0
	for i in s:
		su += int(i)
	return su % 4 == 0
n = int(input())
while not f(str(n)):
	n += 1
print(n)


def s_d(n):
	n = str(n)
	a = 0
	for char in n:
		a += int(char)
	return a
n = int(input())
tab = []
for x in range(1200):
	if s_d(x) % 4 == 0:
		tab.append(x)
i = 0
while tab[i] < n:
	i += 1
print(tab[i])


def summ(s):
	s = [int(s[_]) for _ in range(len(s))]
	return sum(s)
s = int(input())
while summ(str(s)) % 4 != 0:
	s += 1
print(s)


a = int(input())
n = a
while True:
	n = str(n)
	ans = 0
	for c in n:
		ans += int(c)
	n = int(n)
	if ans % 4 == 0:
		print(n)
		break
	n += 1


import math
t = int(input())
m = list(str(t))
s = 0
for i in range(0, len(m)):
	s += int(m[i])
if s % 4 == 0:
	print(t)
else:
	while s % 4 != 0:
		t += 1
		m = list(str(t))
		s = 0
		for i in range(0, len(m)):
			s += int(m[i])
	print(t)


a = int(input())
while (a // 1000 + a % 1000 // 100 + a % 100 // 10 + a % 10) % 4 > 0:
	a = a + 1
print(a)


def sumdig(n1):
	s = 0
	while n1 > 0:
		s = s + n1 % 10
		n1 = n1 // 10
	return s
a = int(input())
n = a
while n >= a:
	k = sumdig(n)
	if k % 4 == 0:
		print(n)
		break
	n += 1


a = str(input())

def summ(a):
	s = 0
	for x in a:
		s += int(x)
	return s
while summ(a) % 4 != 0:
	a = str(int(a) + 1)
print(a)


import sys
input = sys.stdin.readline

def sum_digits(num):
	total = 0
	for d in num:
		total += int(d)
	return total
num = input().rstrip()
while sum_digits(num) % 4 != 0:
	num = str(int(num) + 1)
print(num)


ciselko = int(input())

def zrobsum(numba):
	x = 0
	for i in str(numba):
		x += int(i)
	return x
while zrobsum(ciselko) % 4 != 0:
	ciselko += 1
print(ciselko)


a = int(input())
while True:
	b = [int(i) for i in str(a)]
	if sum(b) % 4 == 0:
		print(a)
		break
	else:
		a += 1


n = int(input())

def sum_digits(num):
	r = str(num)
	result = 0
	for i in range(len(r)):
		result += ord(r[i]) - 48
	return result
while sum_digits(n) % 4 != 0:
	n += 1
print(n)


n = int(input())

def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
while 1:
	a = sum_digits(n)
	if a % 4 == 0:
		print(n)
		break
	n += 1


n = int(input())
f = 0
while f == 0:
	t = str(n)
	c = 0
	for i in t:
		c += int(i)
	if c % 4 == 0:
		print(t)
		f = 1
		break
	else:
		n = n + 1


n = int(input())

def sod(n):
	s = str(n)
	c = 0
	for i in range(len(s)):
		c = c + int(s[i])
	return c
for i in range(n, 1000000):
	if sod(i) % 4 == 0:
		print(i)
		break


s = int(input())
while True:
	z = [int(i) for i in str(s)]
	k = sum(z)
	if k % 4 == 0:
		print(s)
		exit()
	else:
		s += 1


a = input()

def fun(a):
	b = 0
	for i in a:
		b += int(i)
	if b % 4 == 0:
		print(a)
	else:
		a = int(a) + 1
		a = str(a)
		fun(a)
fun(a)


a = int(input())
for i in range(a, 10000000):
	q = str(i)
	s = 0
	for j in q:
		s += ord(j) - ord('0')
	if s % 4 == 0:
		print(i)
		return


n = int(input())
for i in range(n, n + 10):
	ans = 0
	for j in str(i):
		ans += int(j)
	if ans % 4 == 0:
		print(i)
		return


k = input()
n = int(k)
array = []
j = 0

def func(k):
	sum = 0
	for x in k:
		sum = sum + int(x)
	return sum % 4
for y in range(n, n + 8):
	if func(str(y)) == 0:
		print(y)
		break


a = int(input())
for i in range(a, 1004):
	if sum(list(map(int, list(str(i))))) % 4 == 0:
		print(i)
		exit()


def ds(n):
	r = 0
	sum = 0
	while n != 0:
		r = n % 10
		sum += r
		n //= 10
	return sum
t = int(input())
u = ds(t)
a = t
if u % 4 == 0:
	print(a)
else:
	for i in range(1, 1000 + 1, 1):
		a += 1
		e = ds(a)
		if e % 4 == 0:
			break
		else:
			continue
	print(a)


from sys import stdin

def main():
	A = int(input())
	for a in range(A, 1004):
		sum_ = 0
		i = a
		while i > 0:
			sum_ += i % 10
			i = i // 10
		if not sum_ % 4:
			print(a)
			return
input = lambda : stdin.readline()
main()


from functools import reduce

def sumofnums(inp):
	return reduce(lambda a, b: a + int(b), str(inp), 0)

def main():
	inp = int(input())
	while True:
		if sumofnums(inp) % 4 == 0:
			print(inp)
			break
		inp += 1
main()


a = int(input())
a1 = a

def sum_digits(n):
	sum1 = 0
	while n != 0:
		rem = n % 10
		sum1 += rem
		n = n // 10
	return sum1
while 1:
	if sum_digits(a) % 4 == 0:
		sum2 = sum_digits(a)
		break
	else:
		a += 1
diff = abs(a - a1)
print(a1 + diff)


def sumofdig(n):
	li = [int(x) for x in list(str(n))]
	sum = 0
	for item in li:
		sum = sum + item
	return sum
n = int(input())
while sumofdig(n) % 4 != 0:
	n = n + 1
print(n)


a = int(input())
a -= 1
while True:
	sum = 0
	a += 1
	i = a
	while i > 0:
		sum += i % 10
		i /= 10
		i = int(i)
	if sum % 4 == 0:
		break
print(a)


n = int(input())
answer = 0
for i in range(n, 2 * n + 5):
	if sum(list(map(int, list(str(i))))) % 4 == 0:
		answer = i
		break
print(answer)


def good(a):
	cur = 0
	while a > 0:
		cur += a % 10
		a //= 10
	return cur % 4 == 0
n = int(input())
while not good(n):
	n += 1
print(n)


def digit(n):
	sum = 0
	while n > 0:
		sum += n % 10
		n //= 10
	return sum
n = int(input())
(ans1, ans2) = (0, 0)
(x, y) = (n, n)
if digit(n) % 4 == 0:
	print(n)
else:
	y += 1
	while True:
		if digit(y) % 4 == 0:
			ans1 = y
			break
		else:
			y += 1
	print(ans1)


z = input
from math import ceil, log, gcd
n = int(z())
for i in range(n, 10001):
	l = list(map(int, str(i)))
	if sum(l) % 4 == 0:
		print(''.join((str(j) for j in l)))
		break


a = int(input())
v = str(a)
sum1 = 0
for i in range(len(v)):
	sum1 = sum1 + int(v[i])
if sum1 % 4 == 0:
	print(a)
else:
	while True:
		a = a + 1
		v = str(a)
		sum1 = 0
		for i in range(len(v)):
			sum1 = sum1 + int(v[i])
		if sum1 % 4 == 0:
			print(a)
			break
		else:
			continue


def check(a):
	i = 0
	sum = 0
	while i < len(a):
		sum += int(a[i])
		i += 1
	if sum % 4 == 0:
		return True
	else:
		return False
a = input()
while True:
	if check(a):
		break
	else:
		a = str(int(a) + 1)
print(a)


def summa(b):
	s = 0
	while b != 0:
		s += b % 10
		b //= 10
	return s
a = int(input())
while summa(a) % 4 != 0:
	a += 1
print(a)


def int_list(n):
	strings = [str(i) for i in n]
	a_string = ''.join(strings)
	an_integer = int(a_string)
	return an_integer
n = int(input())
n = [int(i) for i in str(n)]
while sum(n) % 4 != 0:
	dif = 4 - sum(n) % 4
	n = int_list(n) + min(dif, sum(n) % 4)
	n = [int(i) for i in str(n)]
print(int_list(n))


n = int(input())

def sum_digits(number):
	tmp = 0
	while number > 0:
		tmp += number % 10
		number = int(number / 10)
	return tmp
while sum_digits(n) % 4 != 0:
	n += 1
print(n)


def check(a):
	sum = 0
	for i in range(0, len(a)):
		sum = sum + int(a[i])
	return sum

def call(a):
	sum = 0
	inta = int(a)
	if 1 <= inta and inta <= 1000:
		sum = check(a)
		if sum % 4 == 0:
			return inta
		while sum % 4 != 0:
			inta = inta + 1
			sum = check(str(inta))
		return inta
a = input()
print(call(a))


n = int(input())
k = list(map(int, str(n)))
s = sum(k)
rem = s % 4
if rem == 0:
	print(n)
else:
	for x in range(1, 8):
		k = n + x
		p = list(map(int, str(k)))
		z = sum(p)
		if z % 4 == 0:
			print(k)
			break


def f(n):
	n = str(n)
	c = 0
	for i in range(len(n)):
		c += int(n[i])
	return c
n = int(input())
while True:
	if f(n) % 4 == 0:
		print(n)
		break
	else:
		n += 1


def check(a):
	s = 0
	while a:
		s += a % 10
		a = a // 10
	return s % 4 == 0
a = int(input())
while not check(a):
	a += 1
print(a)


a = int(input())

def sum(c):
	res = 0
	while c > 0:
		res += c % 10
		c = c // 10
	return res
while sum(a) % 4 != 0:
	a += 1
print(a)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def sum(n):
	e = 0
	k = str(n)
	for i in k:
		e += int(i)
	return e
n = I()
k = str(n)
e = 0

def sum(n):
	e = 0
	k = str(n)
	for i in k:
		e += int(i)
	return e
for i in range(n, n + 1000):
	if sum(i) % 4 == 0:
		print(i)
		break


def check(n):
	summed = 0
	for i in n:
		summed += int(i)
	if summed % 4 == 0:
		return n
	if int(n[-1]) + 4 - summed % 4 < 10:
		return n[:-1] + str(int(n[-1]) + 4 - summed % 4)
	else:
		out = 0
		n = str(int(n[:-1]) + 1) + '0'
		for i in n:
			out += int(i)
		if out % 4 == 0:
			return n
		if 0 + 4 - out % 4 < 10:
			return n[:-1] + str(int(n[-1]) + 4 - out % 4)
n = input()
a = check('0' + n)
print(int(a))


while True:
	try:
		n = input()
		flag = True
		while flag:
			sum = 0
			temp = int(n)
			for i in range(len(n)):
				sum += int(n[i])
			if sum % 4 == 0:
				flag = False
			else:
				temp += 1
				n = str(temp)
		print(n)
	except EOFError:
		break


import sys
import math
n = int(input())

def sumNum(n):
	sum = 0
	while n != 0:
		sum += n % 10
		n = int(n / 10)
	return sum
for i in range(1000):
	if sumNum(n + i) % 4 == 0:
		print(n + i)
		break


a = int(input())
while True:
	l = [int(x) for x in str(a)]
	if sum(l) % 4 == 0:
		print(a)
		break
	else:
		a = a + 1


a = int(input())
flag = 0
ans = -1
while flag == 0:
	s1 = str(a)
	count = 0
	for i in s1:
		count += int(i)
	if count % 4 == 0:
		print(a)
		exit(0)
	a += 1


a = int(input())
fans = 0
for i in range(0, 10):
	p = a + i
	ans = 0
	while p != 0:
		ans += p % 10
		p = p // 10
	if ans % 4 == 0:
		fans = a + i
		break
print(fans)


a = int(input())
c = 0
for i in range(a, a + 10):
	for b in str(i):
		c += int(b)
	if c % 4 == 0:
		print(i)
		break
	else:
		c = 0


def inte(n):
	n = list(str(n))
	for i in range(100):
		k = list(map(int, n))
		sum1 = sum(k)
		if sum1 % 4 == 0:
			return int(''.join(n))
		else:
			n = int(''.join(n))
			n += 1
			n = list(str(n))
	return int(''.join(n))
a = input()
print(inte(a))


def get_sum(n):
	return sum(list(map(int, list(str(n)))))
number = int(input())
s = get_sum(number)
if s % 4 != 0:
	while s % 4 != 0:
		number += 1
		s = get_sum(number)
print(number)


a = int(input())
a1 = []
S1 = 0
t = False
while not t:
	a1 = list(str(a))
	for i in range(len(a1)):
		a1[i] = int(a1[i])
		S1 += a1[i]
	if S1 % 4 == 0:
		t = True
	else:
		a += 1
		S1 = 0
print(a)


def sum(n):
	s = 0
	n = str(n)
	for i in range(len(n)):
		s += int(n[i])
	return s
left = int(input())
while True:
	if sum(left) % 4 == 0:
		print(left)
		exit()
	left += 1


n = int(input())
i = n
while True:
	c = 0
	for j in str(i):
		c += int(j)
	if c % 4 == 0:
		print(i)
		break
	i += 1


a = int(input())
a = a - 1
soma = 10
while soma % 4 != 0:
	a = a + 1
	soma = 0
	n = a
	while n != 0:
		num = n % 10
		n = n // 10
		soma = soma + num
print(a)


def sum(n):
	c = 0
	while n > 0:
		c = c + n % 10
		n = n // 10
	return c
n = int(input())
t = n
d = sum(n)
if d % 4 == 0:
	print(t)
else:
	while True:
		t = t + 1
		d = sum(t)
		if d % 4 == 0:
			print(t)
			break


n = list(map(int, ' '.join(input()).split()))
while True:
	s = sum(n)
	if s % 4 == 0:
		print(''.join(list(map(str, n))))
		exit()
	n = int(''.join(list(map(str, n)))) + 1
	n = list(map(int, ' '.join(str(n)).split()))


n = int(input())
c = 0
while True:
	l = list(str(n))
	if sum(map(int, l)) % 4 == 0:
		c = n
		break
	else:
		n += 1
print(c)


n = int(input())
ans = 453532525
x = n
val = 0
while x > 0:
	val += x % 10
	x //= 10
if val % 4 == 0:
	print(n)
	exit()
for i in range(n, n + 1000, 1):
	x = i
	val = 0
	while x > 0:
		val += x % 10
		x //= 10
	if val % 4 == 0:
		ans = i
		break
print(ans)


def f(x):
	a = 0
	while x:
		a += x % 10
		x //= 10
	return a % 4 == 0
n = int(input())
for i in range(n, 100000000000000000000):
	if f(i):
		print(i)
		break


def find_sum(number):
	sum_ = 0
	while number:
		sum_ += number % 10
		number = number // 10
	return sum_
n = int(input())
next_mulp = (n // 4 + 1) * 4
while True:
	sum_ = find_sum(next_mulp)
	if sum_ % 4 == 0:
		break
	else:
		next_mulp = next_mulp + ((sum_ // 4 + 1) * 4 - sum_)
while True:
	sum_ = find_sum(n)
	number = n
	if sum_ % 4 == 0:
		if n <= next_mulp:
			print(n)
		else:
			print(next_mulp)
		break
	else:
		n = n + ((sum_ // 4 + 1) * 4 - sum_)


def sm(st):
	res = 0
	for s in st:
		res += int(s)
	return not res % 4 == 0
num = int(input().strip())
while sm(str(num)):
	num += 1
print(num)


num = input()
found = False
while not found:
	sum = 0
	for i in range(len(num)):
		sum += int(num[i])
	if sum % 4 == 0:
		found = True
	else:
		num = str(int(num) + 1)
print(num)


n = int(input())
for i in range(100):
	c = 0
	k = n
	while k > 0:
		c = c + k % 10
		k = k // 10
	if c % 4 == 0:
		print(n)
		break
	n = n + 1


a = int(input())

def numberSum(a):
	sum = 0
	while a > 0:
		sum += a % 10
		a //= 10
	return sum

def isIntresting(a):
	return numberSum(a) % 4 == 0
i = a
while not isIntresting(i):
	i += 1
print(i)


n = input()
sum = 0
while True:
	for i in range(len(n)):
		sum += int(n[i])
	if sum % 4 == 0:
		print(n)
		break
	else:
		n = int(n)
		n += 1
		n = str(n)
		sum = 0


n = int(input())
for x in range(n, 1100):
	j = str(x)
	c = 0
	for y in j:
		c += int(y)
	if c % 4 == 0:
		print(x)
		break


a = int(input())

def chk(a):
	temp = a
	rem = 0
	rev = 0
	while a > 0:
		rem = a % 10
		a = a // 10
		rev += rem
	if rev % 4 == 0:
		return temp
	else:
		return chk(temp + 1)
print(chk(a))


def check(n):
	x = n
	ans = 0
	while x > 0:
		ans += x % 10
		x //= 10
	return ans % 4 == 0
a = int(input())
while True:
	if check(a) == True:
		print(a)
		break
	a += 1


_DEBUG = True

def solve(n):
	for j in range(n, 10 ** 10):
		if sum(map(int, str(j))) % 4 == 0:
			return j
	return None
n = int(input())
print(solve(n))


n = int(input())

def s(n):
	cnt = 0
	for i in str(n):
		cnt = cnt + int(i)
	return cnt
for i in range(n, n + 10):
	if s(i) % 4 == 0:
		print(i)
		break


import sys
a = str(input())
s_a = sum([int(i) for i in a])
last_a = int(a[-1])
s_ad4 = s_a % 4
if s_ad4 == 0:
	print(a)
elif 10 - last_a > 4 - s_ad4:
	print(a[:-1] + str(4 - s_ad4 + last_a))
else:
	a = str(int(a) + 10 - last_a)
	s_a = sum([int(i) for i in a])
	last_a = int(a[-1])
	s_ad4 = s_a % 4
	if s_ad4 == 0:
		print(a)
	else:
		print(a[:-1] + str(4 - s_ad4 + last_a))


from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans
l = []
n = ii()
for i in range(1, 10000):
	x = str(i)
	sum = 0
	for j in range(len(x)):
		sum += int(x[j])
	if sum % 4 == 0:
		l.append(int(x))
for i in range(len(l)):
	if n <= l[i]:
		print(l[i])
		break


a = input()
s = sum(map(lambda x: int(x), a))
while s % 4 > 0:
	a = str(int(a) + 1)
	s = sum(map(lambda x: int(x), a))
print(a)


n = input()
s = 0
for ele in n:
	s += int(ele)
if s % 4 == 0:
	print(n)
else:
	n = int(n)
	n += 1
	c = 1
	while c:
		n = str(n)
		s = 0
		for ele in n:
			s += int(ele)
		if s % 4 == 0:
			c = 0
			break
		n = int(n)
		n += 1
	print(n)


a = int(input())

def sm(a):
	d = 0
	for i in str(a):
		d += int(i)
	return d
while sm(a) % 4 != 0:
	a += 1
print(a)


num = input()
ch = 0
while ch != 1:
	chh = 0
	for i in range(len(num)):
		chh += int(num[i])
	if chh % 4 == 0:
		ch = 1
	else:
		num = str(int(num) + 1)
print(num)


def countSum(a):
	answer = 0
	while a > 0:
		answer += a % 10
		a //= 10
	return answer
a = int(input())
flag = 0
while not flag:
	cur_sum = countSum(a)
	if cur_sum % 4 == 0:
		break
	a += 1
print(a)


a = int(input())
f = lambda x: sum((int(i) for i in str(x)))
for i in range(a, 100000):
	if f(i) % 4 == 0:
		print(i)
		break


n = int(input())
while True:
	s = str(n)
	sm = 0
	for x in s:
		sm += ord(x) - ord('0')
	if sm % 4 == 0:
		print(n)
		exit(0)
	n += 1


def summ(n):
	sm = 0
	while n:
		sm += n % 10
		n //= 10
	return sm
n = int(input())
r = summ(n)
c = 0
while r % 4 != 0:
	n += 1
	if summ(n) % 4 == 0:
		break
print(n)


def check(num):
	(flag, sum) = (0, 0)
	for i in num:
		sum = sum + int(i)
	if sum % 4 == 0:
		flag = 1
	return flag
num = input()
while check(num) != 1:
	num = str(int(num) + 1)
print(num)


strnum = input()
intnum = int(strnum)
result = intnum
while True:
	sumnum = sum([int(char) for char in strnum])
	if sumnum % 4 == 0:
		result = intnum
		break
	intnum += 1
	strnum = str(intnum)
print(result)


s = input()
sum = 0
for i in s:
	sum += int(i)
if sum % 4 == 0:
	print(s)
else:
	while 1:
		sum1 = 0
		s = int(s)
		s += 1
		s = str(s)
		for i in s:
			sum1 += int(i)
		if sum1 % 4 == 0:
			print(s)
			break


def digitsum(n):
	d = list(str(n))
	wa = 0
	for di in d:
		wa += int(di)
	return wa
a = int(input())
for n in range(a, 1004):
	if digitsum(n) % 4 == 0:
		print(n)
		break


a = int(input())
x = a
flag = 1
i = 0
while flag:
	x = a + i
	s = 0
	while x != 0:
		s = s + x % 10
		x = x // 10
	if s % 4 == 0:
		flag = 0
	i += 1
print(a + i - 1)


def solve():
	a = int(input())
	n = str(a)
	while True:
		if sum((int(s) for s in n)) % 4 == 0:
			break
		else:
			a += 1
			n = str(a)
	print(n)
solve()


a = int(input())
s = sum(map(int, str(a)))
while s % 4 != 0:
	a += 1
	if sum(map(int, str(a))) % 4 == 0:
		break
print(a)


def notwork(n):
	x = 0
	for i in str(n):
		x += int(i)
	return x % 4 != 0
n = int(input())
while notwork(n):
	n += 1
print(n)


def check(a):
	s = str(a)
	t = 0
	for el in s:
		t += int(el)
	return t % 4 == 0
n = int(input())
while not check(n):
	n += 1
print(n)


n = int(input())

def devide_sub_tofour(n):
	ans = 0
	while True:
		if int(n / 10) == 0:
			ans += n % 10
			break
		ans += n % 10
		n = int(n / 10)
	if ans % 4 == 0:
		return True
	return False
while True:
	if devide_sub_tofour(n):
		break
	n += 1
print(n)


def getsumDigits(n):
	sumOfdigits = 0
	for i in str(n):
		sumOfdigits += int(i)
	return sumOfdigits
n = int(input())
x = getsumDigits(n)
while x % 4 != 0:
	n += 1
	x = getsumDigits(n)
print(n)


def sum_digits(a):
	k = a
	s = 0
	while k > 0:
		s += k % 10
		k //= 10
	return s
a = int(input())
while sum_digits(a) % 4 != 0:
	a += 1
print(a)


a = int(input())
while True:
	b = str(a)
	k = 0
	for i in b:
		k += int(i)
	if k % 4 == 0:
		print(b)
		break
	a = a + 1


n = input()
while True:
	lst = [int(x) for x in n]
	sam = sum(lst)
	if sam % 4 == 0:
		for i in lst:
			print(i, end='')
		break
	n = str(int(n) + 1)


def check(x):
	sum = 0
	while x > 0:
		sum += x % 10
		x //= 10
	if sum % 4 == 0:
		return True
	else:
		return False
x = int(input())
while not check(x):
	x += 1
print(x)


def sm(s):
	s = str(s)
	val = 0
	for x in s:
		val += int(x)
	return val % 4 == 0
s = int(input())
while 1:
	if sm(s):
		print(s)
		break
	s += 1


n = input()
l = []
count = 0
flag = 0
num = 0
ok = True
s = ''
while ok:
	count = 0
	num = 0
	flag = 0
	for j in range(len(n)):
		l.append(int(n[j]))
	for j in range(len(n)):
		count += l[j]
	if count % 4 == 0:
		flag = 0
		ok = False
	else:
		flag = 1
	for j in range(len(n)):
		num = num + 10 ** j * l[len(n) - 1 - j]
	num = num + flag
	for j in range(len(n)):
		del l[0]
	n = str(num)
print(num)


def sod(a):
	su = 0
	while a > 0:
		su = su + a % 10
		a = a // 10
	return su
a = int(input())
for i in range(10):
	su = sod(a)
	if su % 4 == 0:
		print(a)
		break
	else:
		a = a + 1


x = input()
y = []
d = 0
b = []
k = 0
z = int(x)
for i in range(0, len(x)):
	y.append(x[i])
for c in y:
	d += int(c)
if d % 4 == 0:
	print(x)
else:
	while True:
		z += 1
		x = str(z)
		for i in range(0, len(x)):
			b.append(x[i])
		for c in b:
			k += int(c)
		if k % 4 == 0:
			print(z)
			break
		b = []
		k = 0


a = input()
for i in range(int(a), 1009):
	s = 0
	b = str(i)
	for j in b:
		s += int(j)
	if s % 4 == 0:
		print(i)
		break
	else:
		continue


a = int(input())
while True:
	if sum([int(d) for d in str(a)]) % 4 == 0:
		print(a)
		break
	a += 1


a = int(input())
ma = a
for i in range(a, a + 1000):
	x = list(str(i))
	x = list(map(int, x))
	if sum(x) % 4 == 0:
		ma = i
		break
print(ma)


def su(n):
	som = 0
	while n > 0:
		som += n % 10
		n //= 10
	return som
n = int(input())
res = n
som = su(n)
while som % 4 != 0:
	res += 1
	som = su(res)
print(res)


a = int(input())
s = 0
n = a
while True:
	a = n
	s = 0
	while a > 0:
		d = a % 10
		a = int(a / 10)
		s = s + d
	if s % 4 == 0:
		print(n)
		break
	else:
		n = n + 1


def sum_digits(x):
	result = 0
	while x > 0:
		result += x % 10
		x = x // 10
	return result

def min_interesting(a):
	current = a
	while True:
		result = sum_digits(current) % 4
		if result == 0:
			return current
		current += 1
a = int(input())
print(min_interesting(a))


def pp(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	return s
a = int(input())
if pp(a) % 4 == 0:
	print(a)
else:
	while 1:
		a = a + 1
		if pp(a) % 4 == 0:
			break
	print(a)


test = int(input())
digits = 0
for i in str(test):
	digits += int(i)
if digits % 4 == 0:
	print(test)
else:
	while True:
		test += 1
		digits = 0
		for i in str(test):
			digits += int(i)
		if digits % 4 == 0:
			print(test)
			break


n = int(input())
for i in range(n, 1000000):
	s = str(i)
	tmp = 0
	for x in s:
		tmp += int(x)
	if tmp % 4 == 0:
		print(i)
		break


def calc(K):
	for i in range(8):
		s = sum((int(i) for i in str(K)))
		if not s % 4:
			return K
		K += 1
print(calc(int(input())))


def Sum_Of_Digits(Number):
	Sum = 0
	while Number > 0:
		Reminder = Number % 10
		Sum = Sum + Reminder
		Number = Number // 10
	return Sum
Number = int(input())
Sum = Sum_Of_Digits(Number)
while Sum % 4 != 0:
	Number = Number + 1
	Sum = Sum_Of_Digits(Number)
print(Number)


n = int(input())

def check(s):
	m = list(map(int, str(s)))
	if sum(m) % 4 == 0:
		return True
	else:
		return False
while True:
	a = check(n)
	if a is True:
		print(n)
		break
	else:
		n += 1


a = input()

def interesting(a):
	sum = 0
	for i in a:
		sum += int(i)
	if sum % 4 == 0:
		print(a)
	else:
		interesting(str(int(a) + 1))
interesting(a)


def summing(s):
	l = []
	for i in range(len(s)):
		l.append(int(s[i]))
	return l
s = input()
n = int(s)
l = summing(s)
i = 0
while 1:
	if sum(summing(str(n + i))) % 4 == 0:
		print(int(s) + i)
		break
	i += 1


def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s

def find_interest(a):
	while True:
		if sum_digits(a) % 4 == 0:
			return a
		a += 1
a = int(input())
print(find_interest(a))


n = int(input())
s = 0
ans = 0
num = 0
for i in range(n, 100000):
	num = i
	while num > 0:
		s += num % 10
		num //= 10
	if s % 4 == 0:
		ans = i
		break
	else:
		s = 0
print(ans)


import sys
nums = [int(x) for x in sys.stdin.read().split()]
if len(nums) != 1:
	sys.exit(1)
num = nums[0]

def sum_digits(num):
	return sum([int(x) for x in str(num)])
while sum_digits(num) % 4 != 0:
	num += 1
sys.stdout.write(str(num) + '\n')


f = input()
for i in range(int(f), 1200):
	c = 0
	for i in range(len(f)):
		c += int(f[i])
	if c % 4 == 0:
		print(f)
		break
	else:
		c = 0
		n = int(f) + 1
		f = str(n)


a = input()
b = 0
w = 0
for i in range(len(a)):
	b = b + int(a[i])
while b % 4 != 0:
	b = 0
	a = int(a) + 1
	a = str(a)
	for i in range(len(a)):
		b = b + int(a[i])
print(a)


def ddbf(x):
	sm = 0
	while x != 0:
		sm += x % 10
		x //= 10
	return sm % 4 == 0
a = int(input())
while not ddbf(a):
	a += 1
print(a)


import sys
from math import *
from fractions import gcd
readints = lambda : map(int, input().strip('\n').split())

def sumd(s):
	sm = 0
	for d in s:
		sm += int(d)
	return sm
a = input()
while sumd(a) % 4 != 0:
	a = str(int(a) + 1)
print(a)


t = input()
while sum(map(int, list(t))) % 4 != 0:
	t = str(int(''.join(t)) + 1)
print(t)


s = input()
x = int(s)
t = 0
for i in s:
	t += int(i)
if t % 4 == 0:
	print(s)
else:
	while t % 4 != 0:
		x += 1
		s = str(x)
		t = 0
		for i in s:
			t += int(i)
	print(x)


si = lambda : input()
n = si()
while True:
	z = int(n)
	t = sum(list(map(int, list(str(z)))))
	if t % 4 == 0:
		print(z)
		break
	else:
		n = str(int(n) + 1)


n = int(input())
temp = n

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
sum = sumDigits(n)
dif = sum % 4
count = 0
if dif != 0:
	while sumDigits(temp) % 4 != 0:
		temp += 1
		count += 1
	temp = n
	count1 = 0
	print(n + count)
else:
	print(n)


import math

def getsolution(num):
	p = 0
	while num > 0:
		p += num % 10
		num -= num % 10
		num /= 10
	return p
x = int(input())
while getsolution(x) % 4 != 0:
	x += 1
print(x)


a = int(input())
flag = True
ans = 0
while flag:
	t = a
	ans = 0
	while t != 0:
		ans += t % 10
		t = int(t / 10)
	if ans % 4 == 0:
		flag = False
	else:
		a += 1
print(a)


t = int(input())
i = t
for j in range(i, 1004):
	temp = j
	sm = 0
	while j != 0:
		rem = j % 10
		sm += rem
		j = j // 10
	if sm % 4 == 0:
		print(temp)
		break


def ds(n):
	n = str(n)
	res = 0
	for i in n:
		res += int(i)
	return res
s = int(input())
while True:
	if ds(s) % 4 == 0:
		print(s)
		break
	s += 1


def sume(s):
	d = 0
	for i in range(len(s)):
		d += int(s[i])
	return d
s = input()
e = sume(s)
while e % 4 != 0:
	s = str(int(s) + 1)
	e = sume(s)
print(s)


def digitSum(n):
	s = str(n)
	array = list(map(int, s))
	return sum(array)
a = int(input())
ans = digitSum(a)
while ans % 4 != 0:
	a += 1
	ans = digitSum(a)
print(a)


n = int(input())

def sum(n):
	s = 0
	while n > 0:
		r = n % 10
		s += r
		n = n // 10
	return s
s = sum(n)
if s % 4 == 0:
	print(n)
else:
	while sum(n) % 4 != 0:
		n += 1
	print(n)


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
n = qi()
while sum([int(i) for i in str(n)]) % 4 != 0:
	n += 1
print(n)


n = int(input())
ans = n
for i in range(n, n + 1000):
	tt = i
	tot = 0
	while tt > 0:
		tot += tt % 10
		tt = tt // 10
	if tot % 4 == 0:
		ans = i
		break
print(ans)


a = int(input())
summation = lambda s: sum([int(i) for i in str(s)])
while summation(a) % 4:
	a += 1
print(a)


a = int(input())
s = 0
rem = a
while rem:
	d = rem % 10
	rem //= 10
	s += d
if s % 4 == 0:
	print(a)
elif (10 - a) % 10 > (4 - s) % 4:
	print(a + (4 - s) % 4)
else:
	a += (10 - a) % 10
	s = 0
	rem = a
	while rem:
		d = rem % 10
		rem //= 10
		s += d
	if s % 4 == 0:
		print(a)
	else:
		print(a + (4 - s) % 4)


a = int(input())
while True:
	k = len(str(a))
	s = 0
	for i in range(k):
		s += int(str(a)[i])
	if s % 4 == 0:
		break
	a += 1
print(a)


a = int(input(''))
sum = 0
t = 0
k = a
while t == 0:
	n = k
	sum = 0
	while n > 0:
		dig = n % 10
		sum = sum + dig
		n = n // 10
	if sum % 4 == 0:
		print(k)
		break
	k += 1


def sum(x):
	s = 0
	while x != 0:
		s = s + x % 10
		x = x // 10
	return s
n = int(input())
for i in range(n, pow(10, 5)):
	if sum(i) % 4 == 0:
		print(i)
		break
	else:
		continue


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	pp = [0] * (limit + 1)
	prime = []
	l[0] = 0
	l[1] = 0
	c = 0
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i] == 1:
			c += 1
		if l[c] == 1:
			pp[i] = 1
	for i in range(1, limit + 1):
		pp[i] += pp[i - 1]
	return pp

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def su(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s

def solve():
	n = inp()
	while True:
		if su(n) % 4 == 0:
			print(n)
			return
		n += 1
for _ in range(1):
	solve()


import sys

def rl():
	return sys.stdin.readline().strip()

def rn():
	return list(map(int, sys.stdin.readline().strip().split()))

def rnn():
	return map(int, sys.stdin.readline().strip().split())

def rln(n):
	l = [None] * n
	for i in range(n):
		l[i] = int(rl())
	return l

def sum_digit(n):
	s = str(n)
	sumi = 0
	for i in range(len(s)):
		sumi += int(s[i])
	return sumi
n = int(input())
while sum_digit(n) % 4 != 0:
	n += 1
print(n)


n = int(input())
num_sum = 0
for i in str(n):
	num_sum += int(i)
if num_sum % 4 == 0:
	print(n)
else:
	while True:
		n += 1
		num_sum = 0
		for i in str(n):
			num_sum += int(i)
		if num_sum % 4 == 0:
			print(n)
			break


def numsum(n):
	a = list(map(int, list(str(n))))
	lsum = 0
	for i in range(len(a)):
		lsum += a[i]
	return lsum
a = int(input())
flag = True
while flag:
	if numsum(a) % 4 == 0:
		print(a)
		flag = False
	a += 1


def isDivisible(n):
	total = 0
	while n > 0:
		d = n % 10
		total += d
		n //= 10
	return total % 4 == 0

def func(n):
	while isDivisible(n) == False:
		n += 1
	return n
n = int(input())
print(func(n))


x = input()
for i in range(10):
	if sum(list(map(int, list(x)))) % 4 == 0:
		exit(print(x))
	else:
		x = int(x) + 1
		x = str(x)


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def test(n):
	sum = 0
	while n:
		sum += n % 10
		n //= 10
	return sum % 4

def main():
	n = sint()
	while True:
		if test(n) == 0:
			print(n)
			break
		n += 1
main()


n = int(input())
for i in range(n, n + 10000):
	s = sum([int(x) for x in str(i)])
	if s % 4 == 0:
		print(i)
		break


q = input()
while sum([int(i) for i in q]) % 4:
	q = str(int(q) + 1)
print(q)


inp = int(input())
i = inp
while i >= inp:
	l = map(int, list(str(i)))
	if sum(l) % 4 == 0:
		print(i)
		break
	i += 1


import math
import sys

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
n = int(input())

def f(n):
	return sum([int(x) for x in n])
while True:
	if f(str(n)) % 4 == 0:
		exit(print(n))
	n += 1


def sum_digs(n):
	summ = 0
	for i in str(n):
		summ += int(i)
	return summ
a = int(input())
while True:
	if sum_digs(a) % 4 == 0:
		break
	else:
		a += 1
print(a)


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su
n = inin()
while digitsum(n) % 4 != 0:
	n += 1
print(n)


import math

def s_dig(x):
	s = 0
	while x > 0:
		s += x % 10
		x //= 10
	return s
a = int(input())
while True:
	if s_dig(a) % 4 == 0:
		print(a)
		break
	a += 1


def digits(n):
	if n < 10:
		return [n]
	result = digits(n // 10)
	result.append(n % 10)
	return result

def inum(n):
	ds = digits(n)
	q = sum(ds) % 4
	if q == 0:
		return n
	elif ds[-1] + 4 - q < 10:
		return n + 4 - q
	else:
		return inum((n // 10 + 1) * 10)
print(inum(int(input())))


def sum_of_digits(n):
	if n == 0:
		return 0
	else:
		return n % 10 + sum_of_digits(n // 10)
a = int(input())
for i in range(a, a + 10):
	if not sum_of_digits(i) % 4:
		print(i)
		break


a = [int(x) for x in input()]
a.reverse()
while len(a) < 4:
	a.append(0)
while sum(a) % 4 != 0:
	if a[0] == 9:
		a[0] = 0
		if a[1] == 9:
			a[1] = 0
			if a[2] == 9:
				a[2] = 0
				a[3] += 1
				continue
			a[2] += 1
			continue
		a[1] += 1
		continue
	a[0] += 1
	continue
print(a[0] + 10 * a[1] + 100 * a[2] + 1000 * a[3])


a = int(input())
b = a
while True:
	sum = 0
	while b:
		sum += int(b % 10)
		b = int(b / 10)
	if sum % 4 == 0:
		print(a)
		break
	else:
		a += 1
		b = a


def deli(a):
	s = 0
	for i in str(a):
		s += int(i)
	return s % 4 == 0
ch = int(input())
while not deli(ch):
	ch += 1
print(ch)


def hh(a):
	k = 0
	z = str(a)
	for i in range(len(z)):
		k += int(z[i])
	return k % 4 == 0
a = int(input())
while not hh(a):
	a += 1
print(a)


def perfectnum(a):
	s = 0
	for i in range(len(a)):
		s += int(a[i])
	if s % 4 == 0:
		print(a)
	else:
		a = str(int(a) + 1)
		perfectnum(a)
num = input()
perfectnum(num)


n1 = int(input())
while True:
	array = []
	n = n1
	while n > 0:
		array.append(n % 10)
		n -= n % 10
		n //= 10
	if sum(array) % 4 == 0:
		print(n1)
		exit(0)
	n1 += 1


def main(a):
	b = [int(i) for i in str(a)]
	if sum(b) % 4 == 0:
		return a
	while sum(b) % 4 != 0:
		a += 1
		b = [int(i) for i in str(a)]
	return a
a = int(input())
print(main(a))


def summ(a):
	result = 0
	while a > 0:
		dig = a % 10
		result += dig
		a = a // 10
	return result
n = int(input())
while summ(n) % 4 != 0:
	n += 1
print(n)


s = input()

def ss(s):
	sum = 0
	for i in range(len(s)):
		sum = sum + int(s[i])
	return sum
for i in range(int(s), 10000000):
	if ss(str(i)) % 4 == 0:
		print(i)
		break


def sd(n):
	sum = 0
	while n > 0:
		sum += n % 10
		n //= 10
	return sum
n = int(input())
i = 0
while 1:
	if sd(n + i) % 4 == 0:
		print(n + i)
		break
	i += 1


n = int(input())
while True:
	st = str(n)
	cnt = 0
	for i in st:
		cnt += int(i)
	if cnt % 4 == 0:
		print(n)
		break
	n += 1


def sumi(N):
	sum_op = 0
	while N > 0:
		sum_op += N % 10
		N = N // 10
	return sum_op
N = int(input())
t = N
for i in range(N, N + 10):
	if sumi(i) % 4 == 0:
		print(i)
		break


def funct(n):
	n = str(n)
	l = len(n)
	n = int(n)
	sum = 0
	x = n
	for i in range(0, l):
		sum = sum + x % 10
		x = x // 10
	return sum
n = input()
n = int(n)
while funct(n) % 4 != 0:
	n += 1
print(n)


a = int(input())
d = 0
for i in str(a):
	d += int(i)
if d % 4 == 0:
	print(a)
else:
	while d % 4 != 0:
		a += 1
		d = 0
		for j in str(a):
			d += int(j)
		if d % 4 == 0:
			print(a)
			break


def Check(n):
	s = str(n)
	sum = 0
	for c in s:
		sum += int(c)
	return sum % 4 == 0
n = int(input())
ans1 = -1
for i in range(n, 100000):
	if Check(i):
		ans1 = i
		break
print(ans1)


def fun(x):
	s = 0
	org = x
	while x:
		s += x % 10
		x = x // 10
	temp = s % 4
	if temp:
		org += 1
		return fun(org)
	else:
		return org
x = int(input())
print(fun(x))


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from heapq import heapify, heappop, heappush
n = int(input())
while n <= 1003:
	s = list(map(int, list(str(n))))
	if sum(s) % 4 == 0:
		break
	n += 1
print(n)


n = int(input())
num = n
for i in range(8):
	n = num + i
	val = n
	num_sum = 0
	while n > 0:
		num_sum = num_sum + n % 10
		n = n // 10
	if num_sum % 4 == 0:
		print(val)
		break


n = int(input())
while True:
	if sum([int(k) for k in str(n)]) % 4 == 0:
		break
	n += 1
print(n)


a = str(input())
b = int(a) - 1
y = 1
while y % 4 != 0:
	b += 1
	a = str(b)
	y = 0
	for i in a:
		y += int(i)
print(a)


def sum_of_digits(n):
	result = 0
	while n != 0:
		result += n % 10
		n = n // 10
	return result
n = int(input())
if sum_of_digits(n) % 4 == 0:
	print(n)
else:
	i = 1
	while True:
		if sum_of_digits(n + i) % 4 == 0:
			break
		i += 1
	print(n + i)


n = int(input())

def a(n):
	ans = 0
	for i in str(n):
		ans += int(i)
	if ans % 4 == 0:
		return 1
	return 0
while 1:
	if a(n) == 1:
		print(n)
		exit()
	n += 1


def sum4(n):
	return sum([int(x) for x in str(n)])
n = int(input())
while sum4(n) % 4 != 0:
	n += 1
print(n)


a = input()
sum = 0
for t in a:
	sum += int(t)
while sum % 4 != 0:
	a = str(int(a) + 1)
	sum = 0
	for t in a:
		sum += int(t)
print(a)


def main(n):
	sum = 0
	while n > 0:
		sum += n % 10
		n = n // 10
	if sum % 4 == 0:
		return False
	else:
		return True
n = int(input())
while main(n):
	n += 1
print(n)


def check(s):
	sum = 0
	while s != 0:
		sum = sum + s % 10
		s = s // 10
	if sum % 4 == 0:
		return True
	else:
		return False
n = int(input())
while check(n) == False:
	n += 1
print(n)


number = int(input())
l1 = [number, number + 1, number + 2, number + 3, number + 4, number + 5, number + 6, number + 7, number + 8, number + 9, number + 10]
for ele in l1:
	el = list(str(ele))
	n = []
	for e in el:
		integer = int(e)
		n.append(integer)
	s = sum(n)
	if s % 4 == 0:
		print(ele)
		break


n = int(input())
ans = 0
while 1:
	x = n
	res = 0
	while x:
		res += x % 10
		x = x // 10
	if res % 4 == 0:
		ans = n
		break
	else:
		n = n + 1
print(ans)


def sum_dig(n):
	k = str(n)
	return sum([int(l) for l in k])
a = int(input())
x = a
while sum_dig(x) % 4:
	x += 1
print(x)


n = int(input())
w = n
while True:
	s = str(w)
	su = 0
	for i in range(len(s)):
		su += int(s[i])
	if su % 4 == 0:
		print(int(w))
		break
	w += 1


x = int(input())
temp = x
s = 0
while temp > 0:
	r = temp % 10
	s = s + r
	temp = temp // 10
if s % 4 == 0:
	print(x)
else:
	for i in range(11):
		x = x + 1
		temp = x
		s = 0
		while temp > 0:
			r = temp % 10
			s = s + r
			temp = temp // 10
		if s % 4 == 0:
			print(x)
			break


n = int(input())
for i in range(n, n + 100):
	x = sum((int(x) for x in str(i)))
	if x % 4 == 0:
		print(i)
		exit()


from sys import stdin

def solve(tc):
	a = int(stdin.readline().strip())
	while True:
		tot = 0
		aa = a
		while aa:
			tot += aa % 10
			aa //= 10
		if tot % 4 == 0:
			print(a)
			return
		a += 1
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


a = int(input())
while 1:
	d = a
	c = d % 10
	while d != 0:
		d = d // 10
		c = c + d % 10
	c = c % 4
	if c == 0:
		break
	a = a + 1
print(a)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]

def get_dig_sum(x):
	return sum([int(y) for y in str(x)])
n = int(input())
while n < 1100:
	if get_dig_sum(n) % 4 == 0:
		print(n)
		break
	n += 1


n = int(input())

def num(n):
	u = list(str(n))
	ans = 0
	for i in u:
		ans += int(i)
	return ans
for i in range(n, n + 20):
	if num(i) % 4 == 0:
		b = i
		break
print(b)


def sumOfDigits(n):
	stringint = str(n)
	answer = 0
	for ch in stringint:
		answer += int(ch)
	return answer
a = int(input())
while sumOfDigits(a) % 4 != 0:
	a += 1
print(a)


i = int(input())
for n in range(i, i + 1000):
	if sum(list(map(int, str(n)))) % 4 == 0:
		print(n)
		exit(0)


a = input()
n = list(map(int, a))
m = sum(n)
f = m % 4
while f != 0:
	a = str(int(a) + 1)
	n = list(map(int, a))
	m = sum(n)
	f = m % 4
print(int(a))


import os
import sys

def solve():
	a = int(input())
	for i in range(a, a + 10):
		s = sum(list(map(int, str(i))))
		if s % 4 == 0:
			print(i)
			break
if 'PYCHARM_HOSTED' in os.environ:
	sys.stdin = open('input.in')
solve()


a = int(input())
flag = True

def sumdig(a):
	s = 0
	while a != 0:
		s = s + a % 10
		a = a // 10
	return s
while flag:
	s = sumdig(a)
	if s % 4 == 0:
		flag = False
	else:
		a += 1
print(a)


n = int(input())
for i in range(n, 2147483647):
	total = 0
	for j in str(i):
		total += int(j)
	if total % 4 == 0:
		print(i)
		break


a = int(input())
for i in range(a, a + 100000):
	if sum(map(int, list(str(i)))) % 4 == 0:
		print(i)
		quit()


def digitsum(n):
	sm = 0
	while n > 0:
		sm += n % 10
		n //= 10
	return sm
a = int(input())
while True:
	s = digitsum(a)
	a += 1
	if s % 4 == 0:
		break
print(a - 1)


a = int(input())

def check4(x):
	r = 0
	for l in str(x):
		r = r + int(l)
	return r % 4 == 0
n = a
while not check4(n):
	n = n + 1
print(n)


a = int(input())
for i in range(a, a + 1000):
	s = str(i)
	k = 0
	for j in s:
		k += int(j)
	if k % 4 == 0:
		print(i)
		break


a = int(input())

def sum(a):
	s = 0
	while a > 0:
		s += a % 10
		a //= 10
	return s % 4 == 0
while 1:
	if sum(a):
		print(a)
		break
	else:
		a += 1


from sys import stdin, stdout

def main():
	x = int(stdin.readline().rstrip())
	while True:
		if test(x):
			print(x)
			break
		x += 1

def test(x):
	sum = 0
	while x:
		sum += x % 10
		x = int(x / 10)
	return sum % 4 == 0
main()


def sum_of_digits(n):
	ans = 0
	while n > 0:
		ans += n % 10
		n = n // 10
	return ans

def solve(n):
	while sum_of_digits(n) % 4 != 0:
		n += 1
	return n
a = int(input())
print(solve(a))


def sum_degits(n):
	n = [i for i in str(n)]
	return sum(map(int, n))
n = int(input())
while True:
	if sum_degits(n) % 4 == 0:
		print(n)
		exit()
	n += 1


def main():
	n = int(input())
	while sum(map(ord, str(n))) % 4:
		n += 1
	print(n)
main()


def a(a):
	count = 0
	for i in a:
		count += int(i)
	return count
n = input()
for i in range(int(n), 1004):
	if a(str(i)) % 4 == 0:
		print(i)
		break


def sumas(numero):
	numero = str(numero)
	suma = 0
	for i in numero:
		suma += int(i)
	return suma

def main():
	numero = int(input())
	suma = sumas(numero)
	while suma % 4 != 0:
		numero += 1
		suma = sumas(numero)
	print(numero)
main()


n = input()
x = sum(map(int, n))
while x % 4 != 0:
	n = str(int(n) + 1)
	x = sum(map(int, n))
print(n)


n = input()
a = list(n)
a = [int(i) for i in a]
count = 0
if sum(a) % 4 == 0:
	print(int(n))
else:
	n1 = int(n)
	while sum(a) % 4 != 0:
		n1 = n1 + 1
		n2 = str(n1)
		a = [int(i) for i in n2]
		count = count + 1
	print(int(n) + count)


n = int(input())
z = n
count = 0
q = n
while q != 0:
	w = q % 10
	count += w
	q = q // 10
while count % 4 != 0:
	z += 1
	q = z
	count = 0
	while q != 0:
		w = q % 10
		count += w
		q = q // 10
print(z)


def num_sum(x):
	sum = 0
	while x != 0:
		sum += x % 10
		x //= 10
	return sum
num = int(input())
while num_sum(num) % 4 != 0:
	num += 1
print(num)


n = int(input())
s = 0
for i in range(30):
	s = 0
	for j in str(n):
		s += int(j)
	if s % 4 == 0:
		print(n)
		break
	n += 1


n = int(input())
i = n
while True:
	k = i
	s = 0
	while k != 0:
		s = s + k % 10
		k = int(k / 10)
	if s % 4 == 0:
		print(i)
		break
	i = i + 1


n = int(input())
s = sum(map(int, list(str(n))))
while s % 4:
	n += 1
	s = sum(map(int, list(str(n))))
print(n)


def digit_sum(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s

def divisible_by_four(n):
	return digit_sum(n) % 4 == 0

def solve(n):
	while not divisible_by_four(n):
		n += 1
	return n
n = int(input())
print(solve(n))


n = input()
c = 0
k = 0

def check(l):
	c = 0
	for i in l:
		c += int(i)
	if c % 4 == 0:
		print(l)
	else:
		x = 0
		x = int(l) + 1
		check(str(x))
check(n)


x = int(input())

def sum_digits3(n):
	r = 0
	while n:
		(r, n) = (r + n % 10, n // 10)
	return r
n = sum_digits3(x)
if n % 4 == 0:
	print(x)
else:
	t = x
	while 1:
		t += 1
		z = sum_digits3(t)
		if z % 4 == 0:
			print(t)
			break


num = int(input())

def sumd(a):
	b = str(a)
	ret = 0
	for i in b:
		ret += int(i)
	return ret
while True:
	if sumd(num) % 4 == 0:
		print(num)
		break
	num += 1


print([i for i in range(int(input()), 2000) if sum((int(d) for d in str(i))) % 4 == 0][0])


n = int(input())
t = False
while t != True:
	sp1 = []
	for i in range(len(str(n))):
		sp1.append(int(str(n)[i]))
	if sum(sp1) % 4 == 0:
		print(n)
		break
	n += 1


import os

def _f(a):
	s = 0
	for c in str(a):
		s += int(c)
	while s % 4 != 0:
		a += 1
		s = 0
		for c in str(a):
			s += int(c)
	return a

def f(a):
	return _f(a)
if os.environ.get('DEBUG', False):
	print(f'{f(432)} = 435')
	print(f'{f(99)} = 103')
	print(f'{f(237)} = 237')
	print(f'{f(42)} = 44')
else:
	print(f(int(input())))


a = int(input())
b = a
s = 0
while b != 0:
	s += b % 10
	b //= 10
while s % 4 != 0:
	a += 1
	b = a
	s = 0
	while b != 0:
		s += b % 10
		b //= 10
print(a)


sin = str(input())
intin = int(sin)
while True:
	sum = 0
	for a in sin:
		sum = sum + int(a)
	if sum % 4 == 0:
		print(sin)
		break
	else:
		intin = intin + 1
		sin = str(intin)


def s(n):
	a = 0
	for x in str(n):
		a += int(x)
	return a
n = int(input())
val = s(n)
if val % 4 == 0:
	print(n)
	exit()
for x in range(n + 1, n + 10, 1):
	if s(x) % 4 == 0:
		print(x)
		exit()


n = int(input())
for i in range(n, n + 7):
	b = i
	val = 0
	while i > 0:
		val += i % 10
		i = i // 10
	if val % 4 == 0:
		print(b)
		break


n = input()
s = int(n)
while 1:
	num = 0
	next = str(s)
	for v in next:
		num += int(v)
	if num % 4 == 0:
		break
	s += 1
print(s)


m = input()
n = int(m)
s = list(m)
s = list(map(int, s))
t = sum(s)
while t % 4 != 0:
	n = n + 1
	m = str(n)
	s = list(m)
	s = list(map(int, s))
	t = sum(s)
print(n)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	while 1:
		s = str(n)
		tot = 0
		for char in s:
			tot += ord(char) - ord('0')
		if tot % 4 == 0:
			print(s)
			break
		n += 1
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


a = int(input())

def sumN(n):
	ans = 0
	while n > 0:
		ans += n % 10
		n = n // 10
	return ans
while sumN(a) % 4 != 0:
	a += 1
print(a)


i = int(input())
while True:
	temp = str(i)
	total = 0
	for j in range(len(temp)):
		total = total + int(temp[j])
	if total % 4 == 0:
		print(temp)
		break
	else:
		i += 1


a = input()
b = []
sum = 0
for i in range(len(a)):
	c = a[i]
	b.append(c)
for i in b:
	sum = sum + int(i)
if sum % 4 == 0:
	print(a)
else:
	m = int(a) + 1
	while m > int(a):
		sum = 0
		d = []
		m = str(m)
		for i in range(len(str(m))):
			c = m[i]
			d.append(c)
		for i in d:
			sum = sum + int(i)
		if sum % 4 == 0:
			print(m)
			break
		else:
			m = int(m) + 1


n = int(input())
for i in range(n, 2000):
	tot = 0
	j = i
	while i > 0:
		dig = i % 10
		tot = tot + dig
		i = i // 10
	if tot % 4 == 0:
		print(j)
		break


def fun(a1):
	s = 0
	for i in a1:
		s += int(i)
	return s
a = int(input())
a1 = list(str(a))
if fun(a1) % 4 == 0:
	print(a)
else:
	while fun(a1) % 4 != 0:
		a1 = ''.join(map(str, a1))
		a1 = int(a1) + 1
		a1 = list(str(a1))
	print(''.join(map(str, a1)))


m = int(input())
s = 0
n = m
while n > 0:
	s += n % 10
	n //= 10
while s % 4 != 0:
	if m % 10 != 9:
		m += 1
		s += 1
	else:
		m += 1
		s = 0
		n = m
		while n > 0:
			s += n % 10
			n //= 10
print(m)


n = int(input())
while 1:
	summ = 0
	s = str(n)
	for i in range(0, len(s)):
		summ = summ + int(s[i])
	if summ % 4 == 0:
		print(n)
		break
	n += 1


a = input()
summ = 0
g = 0
for i in a:
	summ += int(i)
for i in range(33):
	if summ % 4 == 0:
		print(int(a))
		break
	g += 1
	summ = 0
	a = int(a) + 1
	a = str(a)
	for i in a:
		summ += int(i)


n = int(input())
while 1:
	a = []
	for elem in str(n):
		a.append(int(elem))
	if sum(a) % 4 == 0:
		print(n)
		break
	n += 1


def check(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n //= 10
	return ans % 4 == 0
a = int(input())
while not check(a):
	a += 1
print(a)


def divisible(n):
	digitSum = 0
	while n > 0:
		digitSum += n % 10
		n //= 10
	return digitSum % 4 == 0

def divisibleByFour(n):
	while True:
		if divisible(n):
			return n
		n += 1
	return n
n = int(input())
print(divisibleByFour(n))


x = int(input())

def sumDigit(n):
	return sum((int(digit) for digit in str(n)))
for y in range(x, 1004):
	if sumDigit(y) % 4 == 0:
		print(y)
		break


def fin_min(a):
	temp = a
	while check_sum(temp):
		temp += 1
	return temp

def check_sum(a):
	x = str(a)
	sum = 0
	for i in range(len(x)):
		sum += int(x[i])
	if sum % 4:
		return True
	return False
n = int(input())
print(fin_min(n))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	n = I()
	for i in range(n, n + 10):
		s = sum([int(c) for c in str(i)])
		if s % 4 == 0:
			return i
	return -1
print(main())


def solve(x):
	x = str(x)
	ans = 0
	for i in range(len(x)):
		ans += int(x[i])
	if ans % 4 == 0:
		return True
	return False
n = int(input())
for i in range(n, n + 10, 1):
	if solve(n) == True:
		print(n)
		break
	else:
		n += 1


n = int(input())
l = tuple(str(n))

def check(l):
	c = 0
	for i in range(len(l)):
		c += int(l[i])
	return c
while 1:
	if check(l) % 4 == 0:
		print(n)
		break
	else:
		n += 1
		l = tuple(str(n))


def valid(x):
	res = 0
	while x > 0:
		res += x % 10
		x //= 10
	return res % 4 == 0
n = int(input())
for i in range(n, 1004):
	if valid(i):
		print(i)
		exit()


def checker(s):
	su = 0
	for i in s:
		su += int(i)
	if su % 4 == 0:
		return True
	else:
		return False
l = int(input())
for i in range(l, l + 100):
	if checker(str(i)) == True:
		break
print(i)


n = int(input())
while True:
	m = n
	t = m
	s = 0
	while m > 0:
		s = s + m % 10
		m = m // 10
	if s % 4 == 0:
		print(t)
		exit()
	n = n + 1


n = int(input())
d1 = n % 10
d2 = n % 100 // 10
d3 = n // 100 % 10
d4 = n // 1000 % 10
while (d1 + d2 + d3 + d4) % 4 != 0:
	n += 1
	d1 = n % 10
	d2 = n % 100 // 10
	d3 = n // 100 % 10
	d4 = n // 1000 % 10
print(n)


t = input()

def sunt(t):
	a = 0
	for i in range(len(t)):
		a += int(t[i])
	m = a % 4
	return m
if sunt(t) == 0:
	print(t)
	exit()
y = int(t) + 1
while True:
	y = str(y)
	if sunt(y) == 0:
		print(y)
		break
	y = int(y) + 1


def interesting(x):
	new = 0
	while x != 0:
		new += x % 10
		x = x // 10
	if new % 4 == 0:
		return True
	return False
a = int(input())
x = a
while not interesting(x):
	x += 1
print(x)


a = int(input(''))

def sumdigit(a):
	sum = 0
	while a > 0:
		rem = a % 10
		sum = sum + rem
		a = a // 10
	return int(sum)
while sumdigit(a) % 4 != 0:
	a = a + 1
print(a)


n = int(input())

def digits_sum(n):
	res = 0
	while n:
		res += n % 10
		n //= 10
	return res
while digits_sum(n) % 4 != 0:
	n += 1
print(n)


a = int(input())

def digitsum(a):
	return sum((int(c) for c in str(a)))
while digitsum(a) % 4 != 0:
	a += 1
print(a)


nre = int(input())
i = nre
while True:
	sre = str(i)
	pll = 0
	for j in range(len(sre)):
		pll += int(sre[j])
	if pll % 4 == 0:
		print(i)
		break
	i += 1


def f(x):
	s = 0
	while x:
		s = s + x % 10
		x = x // 10
	return s
n = int(input())
while f(n) % 4 != 0:
	n = n + 1
print(n)


n = int(input())

def sommeChiffre(n):
	tt = 0
	while n:
		tt += n % 10
		n //= 10
	return tt
while sommeChiffre(n) % 4:
	n += 1
print(n)


def sumOfDigit(x):
	summ = 0
	while x > 0:
		summ += x % 10
		x = x // 10
	return summ

def check(x):
	if sumOfDigit(x) % 4 == 0:
		return False
	else:
		return True
a = int(input())
while check(a):
	a += 1
print(a)


s = int(input())
while sum(map(int, list(str(s)))) % 4 != 0:
	s += 1
print(s)


def sum_(n):
	s = 0
	while n > 0:
		s = s + n % 10
		n = n // 10
	return s
n = int(input())
f = 0
while f == 0:
	if sum_(n) % 4 == 0:
		print(n)
		f = 1
		break
	else:
		n += 1


n = int(input())
for i in range(n, n + 10):
	su = sum([int(j) for j in str(i)])
	if su % 4 == 0:
		print(i)
		break


a = int(input())
x = []
y = []
if a != 799 and a != 399:
	for i in range(0, len(str(a))):
		x.append(int(str(a)[i]))
	for i in range(0, 10000):
		if (sum(x) + i) % 4 == 0:
			z = a + i
			break
	for i in range(0, len(str(z))):
		y.append(int(str(z)[i]))
	for i in range(0, 10000):
		if (sum(y) + i) % 4 == 0:
			print(z + i)
			break
elif a == 799:
	print(800)
else:
	print(400)


def check(x):
	x = str(x)
	result = []
	for i in range(len(x)):
		result.append(int(x[i]))
	if sum(result) % 4 != 0:
		return False
	else:
		return True
user = int(input())
while check(user) != True:
	user += 1
print(user)


def main():

	def summa(n):
		sum = 0
		s = str(n)
		for i in range(len(s)):
			sum += int(s[i])
		return sum
	n = int(input())
	if summa(n) % 4 == 0:
		print(n)
	else:
		ans = 5
		while ans % 4 != 0:
			n += 1
			ans = summa(n)
		print(n)
main()


def sumdig(a):
	res = 0
	while a > 0:
		x = a % 10
		res += x
		a = a // 10
	return res
n = int(input())
while sumdig(n) % 4 != 0:
	n += 1
print(n)


n = int(input())

def inter(n):
	s = str(n)
	cnt = 0
	for i in s:
		cnt += int(i)
	if cnt % 4:
		return False
	return True
while not inter(n):
	n += 1
print(n)


def isgood(n):
	suma = 0
	for i in n:
		suma += int(i)
	return suma % 4 == 0
n = input()
while True:
	if isgood(n):
		print(n)
		break
	n = int(n)
	n += 1
	n = str(n)


n = int(input())
q = [int(d) for d in str(n)]
s = 0
s = s + sum(q)
if s % 4 == 0:
	print(n)
else:
	while s % 4 != 0:
		n = n + 1
		q = [int(d) for d in str(n)]
		s = 0
		s = s + sum(q)
	print(n)


def nex(a):
	b = str(a)
	s = 0
	for i in range(len(b)):
		s += int(b[i])
	if s % 4 == 0:
		return True
	return False
n = int(input())
while True:
	if nex(n) == True:
		print(n)
		break
	n += 1


n = int(input())
while True:
	x = n
	result = 0
	while x > 0:
		result += x % 10
		x = x // 10
	if result % 4 == 0:
		print(n)
		break
	else:
		n += 1


a = int(input())

def summ(n):
	x = 0
	for i in n:
		x += int(i)
	return x
suaa = 0
suaj = 0
aa = a
aj = a
done = False
while not done:
	if summ(str(aa)) % 4 == 0:
		print(aa)
		done = True
	aa += 1


arr = []

def getSum(n):
	sum = 0
	while n != 0:
		sum = sum + int(n % 10)
		n = int(n / 10)
	return sum
a = int(input())
x = getSum(a)
c = 0
while True:
	k = getSum(a)
	if k % 4 == 0:
		break
	a += 1
print(c + a)


number = input()
no = int(number)

def newSum(number):
	sum = 0
	new = str(number)
	for num in new:
		sum += int(num)
	return sum
while True:
	newNumber = newSum(no)
	if newNumber % 4 == 0:
		break
	no += 1
print(no)


n = int(input())
temp = n
sum = 0
while temp > 0:
	x = temp % 10
	sum = sum + x
	temp = temp // 10
if sum % 4 == 0:
	print(n)
elif n % 10 + 4 - sum % 4 < 10:
	print(n + 4 - sum % 4)
else:
	news = 0
	while n % 10 != 0:
		n += 1
	x = n
	while x > 0:
		news = news + x % 10
		x = x // 10
	if news % 4 == 0:
		print(n)
	else:
		print(n + 4 - news % 4)


a = int(input().strip())
while True:
	sum = 0
	a = str(a)
	for i in range(len(a)):
		sum += int(a[i])
	if sum % 4 == 0:
		print(int(a))
		break
	a = int(a)
	a += 1


def suma(a):
	if a != 0:
		return a % 10 + suma(a // 10)
	return 0
a = int(input())
i = 0
while suma(a + i) % 4 != 0:
	i += 1
print(i + a)


def check(x):
	ans = 0
	while x > 0:
		ans += x % 10
		x //= 10
	return ans % 4
n = int(input())
while check(n):
	n += 1
print(n)


n = int(input())

def sumd(n):
	res = 0
	while n:
		res += n % 10
		n //= 10
	return res
a = n
while sumd(a) % 4 != 0:
	a += 1
print(a)


n = int(input())
x = list(str(n))
su = 0
for el in x:
	su += int(el)
while su % 4:
	n += 1
	x = list(str(n))
	su = 0
	for el in x:
		su += int(el)
print(n)


def getNearestInterestingNum(num):
	while True:
		total = sum([int(i) for i in str(num)])
		if total % 4 == 0:
			return num
		num += 1
n = int(input())
print(getNearestInterestingNum(n))


Num = str(input())
res = 0
for i in Num:
	res += int(i)
if res % 4 == 0:
	print(Num)
else:
	while res % 4 != 0:
		res = 0
		Num = int(Num) + 1
		for i in str(Num):
			res += int(i)
	print(Num)


n = int(input())

def check(x):
	res = sum((int(c) for c in str(x)))
	return res % 4 == 0
while not check(n):
	n += 1
print(n)


def digsum(a):
	x = str(a)
	s = 0
	for i in x:
		s += int(i)
	return s
a = int(input())
while True:
	if digsum(a) % 4 == 0:
		break
	else:
		a += 1
print(a)


a = int(input())
while 1:
	t = str(a)
	p = 0
	for i in t:
		p += int(i)
	if p % 4 == 0:
		break
	a += 1
print(a)


n = int(input())
for i in range(n, n * 100):
	j = str(i)
	ans = 0
	for digit in j:
		ans += int(digit)
	if ans % 4 == 0:
		print(j)
		break


def func(x):
	val = 0
	while x > 0:
		val += x % 10
		x = int(x / 10)
	return val
n = int(input())
while func(n) % 4 != 0:
	n += 1
print(n)


from collections import defaultdict as df
import bisect
from collections import deque

def digsum(n):
	sum1 = 0
	for i in str(n):
		sum1 += int(i)
	return sum1
n = int(input())
for i in range(n, n + 500):
	if digsum(i) % 4 == 0:
		ans = i
		break
print(ans)


def sum(a):
	c = 0
	while a > 0:
		Reminder = a % 10
		c = c + Reminder
		a = a // 10
	return c
n = int(input())
c = 0
if sum(n) % 4 == 0:
	print(n)
else:
	while True:
		if sum(n) % 4 != 0:
			n = n + 1
		else:
			break
	print(n)


n = int(input())

def f(x):
	c = 0
	for i in str(x):
		c += int(i)
	if c % 4 == 0:
		return False
	return True
while f(n):
	n += 1
print(n)


d = int(input())
while sum(map(int, str(d))) % 4 != 0:
	d += 1
print(d)


a = int(input())
if a < 4:
	print(4)
	quit()
n = a
for i in range(a):
	s = list(map(int, str(n)))
	if sum(s) % 4 == 0:
		print(n)
		break
	n += 1


def judge(x):
	s = str(x)
	lis = [int(d) for d in s]
	return sum(lis) % 4 == 0
a = int(input())
while judge(a) == False:
	a += 1
print(a)


n = int(input())
v = len(str(n))
d = n
c = 0
while 1:
	c = c + d % 10
	d = d // 10
	if d == 0:
		break
while 1:
	if c % 4 != 0 and n % 10 != 9:
		c = c + 1
		n = n + 1
	elif c % 4 != 0 and n % 10 == 9 and ((n + 1) % 10 ** (v - 1) == 0) and (0 < (n + 1) // 10 ** (v - 1) < 10):
		c = (n + 1) // 10 ** (v - 1)
		n = n + 1
	elif c % 4 != 0 and n % 10 == 9 and (n + 1 == 10 ** v):
		c = 1
		n = n + 1
	elif c % 4 != 0 and n % 10 == 9:
		c = c - 8
		n = n + 1
	if c % 4 == 0:
		break
print(n)


A = int(input())

def sumdigit(x):
	result = 0
	while x > 0:
		result += x % 10
		x //= 10
	return result
while sumdigit(A) % 4 > 0:
	A += 1
print(A)


N = int(input())
sum = 0
S = N
while N != 0:
	sum += N % 10
	N = N // 10
if sum % 4 == 0:
	print(S)
else:
	for i in range(S + 1, S + 10):
		sum = 0
		j = i
		while j != 0:
			sum += j % 10
			j //= 10
		if sum % 4 == 0:
			print(i)
			break


def an(m):
	a = []
	while m != 0:
		a.append(m % 10)
		m = m // 10
	return sum(a)
n = int(input(''))
b = [-1]
m = n
for i in range(1, 1050):
	if an(i) % 4 == 0:
		b.append(i)
for i in range(1, len(b)):
	if b[i] >= n and b[i - 1] < n:
		print(b[i])
		break


n = int(input())

def sumOfdigits(n):
	sum = 0
	while n > 0:
		r = n % 10
		sum = sum + r
		n = n // 10
	return sum

def interestingnum(n):
	if sumOfdigits(n) % 4 == 0:
		return n
	else:
		return interestingnum(n + 1)
c = interestingnum(n)
print(c)


n = input()
sum = 0
for i in n:
	m = int(i)
	sum += m
if sum % 4 == 0:
	print(n)
else:
	while sum % 4 != 0:
		sum = 0
		for i in n:
			m = int(i)
			sum += m
		x = int(n) + 1
		n = str(x)
	print(int(n) - 1)


def check(a: int):
	tot = 0
	for i in a:
		tot += int(i)
	if tot % 4 == 0:
		return True
	else:
		return False
a = int(input())
while True:
	if check(str(a)):
		print(a)
		break
	a += 1


s = int(input())
s1 = s
l = []
while True:
	sum = 0
	while s != 0:
		l.append(s % 10)
		s //= 10
	for i in range(len(l)):
		sum += l[i]
	if sum % 4 == 0:
		print(s1)
		break
	else:
		s = s1 + 1
		s1 += 1
		l = []


m = input()
s = list(m)
k = 0
p = 1
l = int(m)
while p:
	k = 0
	for i in range(len(s)):
		k += int(s[i])
	if k % 4 != 0:
		l += 1
		s = list(str(l))
	else:
		p = 0
print(l)


n = int(input())
for i in range(n, 100001):
	a = list(map(int, list(str(i))))
	if sum(a) % 4 == 0:
		print(i)
		exit()


year = int(input())
while True:
	a = year // 1000
	b = year // 100 % 10
	c = year // 10 % 10
	d = year % 10
	z = a + b + c + d
	if z % 4 == 0:
		break
	else:
		year += 1
		continue
print(year)


a = int(input())
n = a

def calsum(x):
	sumd = 0
	while x > 0:
		sumd += x % 10
		x = x // 10
	return sumd
while calsum(n) % 4 != 0:
	n += 1
print(n)


a = int(input())

def i(s):
	k = 0
	m = s
	while m > 0:
		k += m % 10
		m = m // 10
	if k % 4 == 0:
		return 1
	return 0
while i(a) == 0:
	a += 1
print(a)


n = int(input())

def check(n):
	x = n
	l = len(str(n))
	add = 0
	for i in range(l):
		remainder = x % 10
		add += remainder
		x //= 10
	if add % 4 == 0:
		print(n)
	else:
		n += 1
		check(n)
check(n)


a = int(input())

def interesting(a):
	s = str(a)
	q = 0
	for i in range(len(s)):
		q += int(s[i])
	return True if q % 4 == 0 else False
while not interesting(a):
	a += 1
print(a)


n = int(input())
for i in range(n, 10001):
	s = 0
	t = i
	while t > 0:
		s += t % 10
		t //= 10
	if s % 4 == 0:
		print(i)
		exit(0)


a = [int(i) for i in list(input())]
while True:
	if sum(a) % 4 == 0:
		a = [str(i) for i in a]
		a = ''.join(a)
		print(a)
		exit()
	else:
		a = [str(i) for i in a]
		a = ''.join(a)
		a = int(a) + 1
		a = [int(i) for i in str(a)]


x = int(input())
count = 0
while count < 1:
	d = list(map(int, list('{}'.format(x))))
	if sum(d) % 4 == 0:
		count = 1
		break
	x += 1
print(x)


def answer():
	a = int(input())
	b = [int(x) for x in list(str(a))]
	if sum(b) % 4:
		while sum(b) % 4:
			a += 1
			b = [int(x) for x in list(str(a))]
	print(a)
answer()


n = input()
while 1:
	p = 0
	for i in range(len(n)):
		p += int(n[i])
	if p % 4 == 0:
		print(n)
		exit()
	q = int(n) + 1
	n = str(q)


n = int(input())
sum = 1
while sum % 4 != 0:
	x = n
	sum = 0
	while x != 0:
		z = x % 10
		sum += z
		x = x // 10
	if sum % 4 == 0:
		break
	else:
		n += 1
print(n)


n = int(input())
f = lambda t: sum(map(int, list(str(t))))
while f(n) % 4 != 0:
	n += 1
print(n)


def nin(n):
	n = str(n)
	num = [int(d) for d in n]
	sum = 0
	for i in num:
		sum += i
	if sum % 4 == 0:
		return n
	n = int(n)
	n += 1
	return nin(n)
n = int(input().strip())
print(nin(n))


s = input()
l = list(map(int, s))
if sum(l) % 4 == 0:
	print(s)
else:
	for i in range(1, 1000):
		a = int(s) + i
		a = str(a)
		l = list(map(int, a))
		if sum(l) % 4 == 0:
			print(a)
			break


X = input()
S = sum([int(i) for i in X])
if S % 4 == 0:
	print(X)
else:
	X = int(X)
	while S % 4 != 0:
		X += 1
		S = sum([int(i) for i in str(X)])
	print(X)


n = input()
x = int(n)
l = list(n)
l = list(map(lambda x: int(x), l))
if sum(l) % 4 == 0:
	print(x)
else:
	while True:
		x = x + 1
		k = list(str(x))
		z = list(map(lambda x: int(x), k))
		if sum(z) % 4 == 0:
			print(x)
			break


n = input()
ans = 0
while True:
	t = 0
	for i in n:
		t += int(i)
	if t % 4 == 0:
		break
	n = str(int(n) + 1)
print(n)


n = str(input())
l = []
for i in range(len(n)):
	l.append(int(n[i]))
if sum(l) % 3 == 0:
	r = ''.join(n)
	r = int(r)
	if r % 3 == 0:
		if sum(l) % 4 == 0:
			print(r)
		else:
			for i in range(1, 10):
				f = r + i
				d = str(f)
				c = 0
				for i in range(len(d)):
					c += int(d[i])
				if c % 4 == 0:
					print(d)
					break
elif sum(l) % 4 == 0:
	r = ''.join(n)
	r = int(r)
	print(r)
else:
	r = ''.join(n)
	r = int(r)
	for i in range(1, 10):
		f = r + i
		d = str(f)
		c = 0
		for i in range(len(d)):
			c += int(d[i])
		if c % 4 == 0:
			print(d)
			break


x = int(input())
p = [int(d) for d in str(x)]
if sum(p) % 4 == 0:
	pass
else:
	q = 1
	while q % 4 != 0:
		x = x + 1
		y = [int(d) for d in str(x)]
		q = sum(y)
print(x)


x = int(input())
while True:
	num = x
	rm = 0
	if True:
		y = str(num)
		for r in y:
			rm += int(r)
		if rm % 4 == 0:
			print(num)
			exit(0)
	x += 1


n = int(input())
for i in range(n, n + 100):
	if sum((int(j) for j in str(i))) % 4 == 0:
		print(i)
		break


def summa(n):
	n = str(n)
	res = 0
	for i in range(len(n)):
		res += int(n[i])
	return res
n = int(input())
while summa(n) % 4 != 0:
	n += 1
print(n)


def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s

def interesting_number(a):
	if sum_digits(a) % 4 == 0:
		return True
	else:
		return False
n = int(input())
while 'banana':
	if interesting_number(n):
		print(n)
		break
	else:
		n += 1


import sys
input = sys.stdin.readline
n = int(input())
while 1:
	if sum((int(nn) for nn in str(n))) % 4 == 0:
		break
	else:
		n += 1
print(n)


def sum_of_digits(number):
	return sum([int(i) for i in str(number)])
number = int(input())
while sum_of_digits(str(number)) % 4 != 0:
	number += 1
print(number)


import sys
from math import ceil
n = int(input())

def bad(a):
	return sum([int(d) for d in str(a)]) % 4
while True:
	if not bad(n):
		print(n)
		break
	else:
		n += 1


a = input()
aaa = list(a)
for i in range(0, 100):
	ok = [int(k) for k in aaa]
	aa = sum(ok)
	if aa % 4 != 0:
		a = int(a)
		a += 1
		a = str(a)
		aaa = list(a)
	else:
		c = a
		break
print(c)


number = int(input())
temp = number

def interesting(number):
	addition = 0
	remainder = 0
	temp = number
	while number != 0:
		remainder = number % 10
		addition = addition + remainder
		number = number // 10
	return addition % 4
for i in range(temp, 1100):
	if interesting(i) == 0:
		print(i)
		break


N = int(input())
while sum(list(map(int, list(str(N))))) % 4 != 0:
	N += 1
print(N)


a = int(input())

def summ(i):
	t = 0
	for j in range(len(i)):
		t += int(i[j])
	return t
i = str(a)
s = 1
if summ(i) % 4 == 0:
	print(a)
else:
	while s % 4 != 0:
		i = str(int(i) + 1)
		s = summ(i)
	print(i)


from math import sqrt

def ok(d):
	v = [int(c) for c in str(d)]
	return sum(v) % 4 == 0

def main():
	d = int(input())
	while not ok(d):
		d += 1
	print(d)
main()


a = int(input())
n = a
while n >= a:
	n1 = n
	answer = 0
	while n1 > 0:
		d = n1 % 10
		answer += d
		n1 = n1 // 10
	if answer % 4 == 0:
		break
	else:
		n += 1
print(n)


n = int(input())
for i in range(n, 1004):
	l = list(map(int, str(i)))
	if sum(l) % 4 == 0:
		print(i)
		break


a = input()
ans = int(a)
while True:
	sum = 0
	a = str(ans)
	for i in a:
		sum += int(i)
	if sum % 4 == 0:
		print(ans)
		exit()
	ans += 1


n = int(input())

def check(num):
	sums = 0
	while num > 0:
		sums += num % 10
		num = num // 10
	return sums
while check(n) % 4 != 0:
	n += 1
print(n)


def summ(x):
	return sum(map(int, list(str(x))))
a = int(input())
i = 0
while True:
	if summ(a + i) % 4 == 0:
		print(a + i)
		break
	i += 1


def s(k):
	r = 0
	while k:
		r += k % 10
		k //= 10
	return r
n = int(input())
while s(n) % 4:
	n += 1
print(n)


def solve(n):
	res = 0
	while n:
		res = (n % 10 + res) % 4
		n //= 10
	if not res:
		return 0
	return 4 - res
n = int(input())
res = solve(n)
if n % 10 + res < 10:
	print(n + res)
else:
	new_n = n + 10 - n % 10
	print(new_n + solve(new_n))


n = int(input())
x = n % 10
y = (n - x) // 10 % 10
z = (n - 10 * y - x) // 100 % 10
if n == 1000 or n == 997 or n == 998 or (n == 999):
	print(1003)
elif n == 1 or n == 2 or n == 3 or (n == 4):
	print(4)
elif n == 5 or n == 6 or n == 7 or (n == 8):
	print(8)
elif n == 38 or n == 37 or n == 36:
	print(39)
elif (x + y + z) % 4 == 0:
	print(n)
else:
	k = (x + y + z) % 4
	if x < 6:
		print(n + 4 - k)
	else:
		m = n % 10
		p = n + 10 - m
		a = p % 10
		b = (p - a) // 10 % 10
		c = (p - 10 * b - a) // 100 % 10
		if (a + b + c) % 4 == 0:
			print(p)
		else:
			l = (a + b + c) % 4
			print(p + 4 - l)


a = int(input())

def jami(a):
	p = 0
	while a:
		p += a % 10
		a //= 10
	return p
while jami(a) % 4 != 0:
	a += 1
print(a)


from sys import stdin, stdout

def main():
	(st, i, read, write) = (str, int, stdin.readline, stdout.write)
	a = i(read())
	write(st(other(a)) + '\n')

def other(a):
	while checker(a) % 4 != 0:
		a += 1
	return a

def checker(a):
	(i, add, st) = (int, 0, str)
	for character in st(a):
		add += i(character)
	return add
main()


a = int(input())
q = a
w = True
while w:
	a = q
	s = 0
	while a > 0:
		s += a % 10
		a = a // 10
	if s % 4 == 0:
		print(q)
		w = False
	q = q + 1


n = int(input())
dig = 0
sum = 0
while 1:
	a = n
	sum = 0
	while a > 0:
		dig = int(a % 10)
		sum = sum + dig
		a = a / 10
	if sum % 4 == 0:
		print(n)
		exit(0)
	n = n + 1


n = int(input())

def isFoursome(i):
	sum = 0
	while i > 0:
		sum = sum + i % 10
		i = i // 10
	return sum % 4 == 0
while isFoursome(n) != True:
	n += 1
print(n)


t = int(input())
while 1:
	t = str(t)
	y = list(t)
	x = list(map(int, y))
	p = sum(x)
	if p % 4 == 0:
		z = ''.join(map(str, x))
		print(z)
		break
	t = int(t) + 1


n = input()
n1 = 0
for i in range(0, 100):
	n1 = int(n) + i
	n1 = str(n1)
	x = list(map(int, n1))
	s = 0
	for j in range(0, len(x)):
		s = s + x[j]
	if s % 4 == 0:
		break
print(n1)


n = int(input())
for i in range(n, n + 30):
	j = str(i)
	z = list(j)
	k = [int(x) for x in z]
	if sum(k) % 4 == 0:
		print(i)
		break


import time
a = int(input())
start = time.time()
n = a
s = sum([int(i) for i in str(n)])
while s % 4 != 0:
	n += 1
	s = sum([int(i) for i in str(n)])
print(n)
finish = time.time()


a = int(input())
s = 5
n = a
while s % 4 != 0:
	s = 0
	c = n
	while c > 0:
		s = s + c % 10
		c = c // 10
	n = n + 1
print(n - 1)


def get_sum(t):
	sum = 0
	while t > 0:
		sum += t % 10
		t = t // 10
	return sum
n = int(input())
sum = get_sum(n)
if sum % 4 == 0:
	print(n)
else:
	for i in range(1, 10):
		k = n + i
		l = get_sum(k)
		if l % 4 == 0:
			print(k)
			break


n = int(input())
for j in range(n, 100000):
	p = 0
	for k in str(j):
		p += int(k)
	if p % 4 == 0:
		print(j)
		break


import sys

def nearest(n):
	while sum(map(int, list(str(n)))) % 4:
		n += 1
	return n
print(nearest(int(sys.stdin.read())))


a = int(input())

def sod(a):
	s = 0
	for i in str(a):
		s += int(i)
	return s
while sod(a) % 4 != 0:
	a += 1
print(a)


import sys

def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
input = sys.stdin.readline
n = int(input())
while sum_digits(n) % 4 != 0:
	n += 1
print(n)


def f(x):
	r = str(x)
	ans = 0
	for i in range(len(r)):
		ans += int(r[i])
	return not ans % 4

def main():
	a = int(input())
	for i in range(a, int('4' * (len(str(a)) + 1)) + 1):
		if f(i):
			print(i)
			return 0
main()


s = input()
s1 = list(s)
a = list(map(int, s1))
k = sum(a)
if k % 4 == 0:
	print(s)
else:
	while 1:
		s = str(int(s) + 1)
		s1 = list(s)
		a = list(map(int, s1))
		k = sum(a)
		if k % 4 == 0:
			print(s)
			break


def ok(x):
	return sum([int(_) for _ in str(x)]) % 4 == 0
n = int(input())
while not ok(n):
	n += 1
print(n)


def solve(n):
	l = [int(i) for i in n]
	l = sum(l)
	if l % 4 == 0:
		return True
	else:
		return False
x = int(input())
sx = str(x)
while not solve(sx):
	x += 1
	sx = str(x)
print(x)


import math
a = int(input())
k = sum(map(int, str(a)))
if k % 4 == 0:
	print(a)
else:
	for i in range(1, 10):
		a = a + 1
		k = sum(map(int, str(a)))
		if k % 4 == 0:
			print(a)
			break


a = input()
b = 0
for j in range(7):
	for i in range(len(a)):
		b += int(a[i])
	if b % 4 == 0:
		break
	else:
		b = 0
		a = str(int(a) + 1)
print(a)


def sum_of_digits(num):
	return sum((int(digit) for digit in str(num)))
num = input()
if sum_of_digits(num) % 4 == 0:
	print(num)
else:
	while sum_of_digits(num) % 4 != 0:
		num = int(num) + 1
	print(num)


def summ(l):
	s = 0
	for i in range(len(l)):
		s += int(l[i])
	return s
n = input()
l = list(n)
s = 0
flag = 0
p = int(n)
while flag == 0:
	x = str(p)
	if summ(list(x)) % 4 == 0:
		print(p)
		break
	p += 1


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
ind = 0
for i in range(101):
	l = [int(j) for j in str(n + i)]
	sm = sum(l)
	if sm % 4 == 0:
		ind = i
		break
print(n + ind)


a = int(input())
t = 1
while t:
	x = a
	s = 0
	while x:
		s += x % 10
		x //= 10
	if s % 4 == 0:
		t = 0
	else:
		a += 1
print(a)


a = input()
while True:
	aa = 0
	for i in a:
		aa += int(i)
	if aa % 4 == 0:
		print(a)
		break
	else:
		a = str(int(a) + 1)


n = int(input())
for x in range(n, n * 40):
	if (x // 1000 + x % 1000 // 100 + x % 100 // 10 + x % 10) % 4 == 0:
		print(x)
		break


def test(x):
	return sum(map(int, list(str(x)))) % 4 == 0
x = int(input())
while test(x) == False:
	x += 1
print(x)


def sumDigits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
s = input()
ns = int(s)
sumd = sumDigits(ns)
modulo = sumd % 4
if not modulo:
	print(s)
else:
	for i in range(ns + 1, ns + 20):
		sumd = sumDigits(i)
		if not sumd % 4:
			print(i)
			break


n = abs(int(input()))
while 1:
	sum = 0
	for i in str(n):
		sum += int(i)
	if sum % 4 == 0:
		break
	n += 1
print(n)


n = int(input())

def interesting(n, sumofdigits=0):
	for i in range(1, len(str(n)) + 1):
		sumofdigits += n % 10
		n = n // 10
	return sumofdigits
if interesting(n) % 4 == 0:
	print(n)
else:
	n += 1
	while True:
		if interesting(n) % 4 == 0:
			print(n)
			break
		else:
			n += 1


def digitsum(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	return s
a = int(input())
if a == 0:
	print(4)
elif digitsum(a) % 4 == 0:
	print(a)
else:
	for i in range(10):
		if digitsum(a + 1) % 4 == 0:
			print(a + 1)
			break
		else:
			a += 1


def sumn(n):
	tot = 0
	while n > 0:
		dig = n % 10
		tot = tot + dig
		n = n // 10
	return tot
n = int(input())
for i in range(0, 13):
	if sumn(i + n) % 4 == 0:
		print(i + n)
		break


n = int(input())

def calc(i):
	res = int(0)
	while i > 0:
		res += i % 10
		i //= 10
	return res
for i in range(n, 1000000000):
	tmp = calc(i)
	if tmp % 4 == 0:
		print(i)
		break


import math
q = 1
for _ in range(q):
	a = int(input())
	sumofdigits = 0
	k = a
	while k > 0:
		sumofdigits += k % 10
		k //= 10
	if sumofdigits % 4 == 0:
		print(a)
	else:
		for i in range(1, 1000):
			k = a + i
			sumofdigits = 0
			while k > 0:
				sumofdigits += k % 10
				k //= 10
			if sumofdigits % 4 == 0:
				print(a + i)
				break


def digsum(x):
	return sum(list(map(int, list(str(x)))))
n = int(input())
a = n
while digsum(a) % 4 != 0:
	a += 1
print(a)


def check(curr):
	sum = 0
	while curr > 0:
		sum = sum + curr % 10
		curr = curr // 10
	if sum % 4 == 0:
		return 1
	else:
		return 0
n = int(input())
while not check(n):
	n = n + 1
print(n)


def digsum(n):
	k = 0
	while n > 0:
		k += n % 10
		n //= 10
	return k
n = int(input())
while digsum(n) % 4 != 0:
	k = digsum(n) % 4
	n += min(k, 4 - k)
print(n)


def main():
	n = int(input())
	while True:
		y = n
		sum1 = 0
		while y > 0:
			sum1 += y % 10
			y //= 10
		if sum1 % 4 == 0:
			print(n)
			break
		n += 1
main()


n = int(input())
for i in range(10):
	a = list(str(n))
	a = [int(i) for i in a]
	if sum(a) % 4 == 0:
		for i in a:
			print(i, end='')
		break
	else:
		n += 1


def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
n = int(input())
sum = -1
while sum % 4 != 0:
	sum = 0
	for c in str(n):
		sum += int(c)
	n += 1
print(n - 1)


a = int(input())

def su(a):
	tmp = 0
	while a != 0:
		tmp += a % 10
		a //= 10
	return tmp
while su(a) % 4 != 0:
	a += 1
print(a)


n = int(input())
x = n
sum = 1
i = 0
while sum % 4 != 0:
	sum = 0
	n = x + i
	while n != 0:
		r = n % 10
		sum += r
		n = n // 10
	i += 1
print(x + (i - 1))


def cal(n):
	sum = 0
	while n > 0:
		sum += n % 10
		n //= 10
	return sum

def main():
	t = int(input())
	while cal(t) % 4 != 0:
		t += 1
	print(t)
	return
main()


def run(a):
	t1 = list(str(a))
	t2 = [int(i) for i in t1]
	while sum(t2) % 4 != 0:
		a += 1
		t2 = [int(i) for i in list(str(a))]
	return t2
a = int(input())
for i in run(a):
	print(i, end='')


a = int(input())
while True:
	summ = 0
	val = a
	while val > 0:
		summ += val % 10
		val //= 10
	if summ % 4 == 0:
		print(a)
		exit()
	a += 1


a = int(input())

def sum_number(number):
	sum = 0
	number = str(number)
	for el in number:
		sum += int(el)
	return sum

def a_sol(number):
	for i in range(10):
		if sum_number(number + i) % 4 == 0:
			return number + i
	return number
print(a_sol(a))


n = input()
n = int(n)
m = n
suma = 1
j = 0
while suma % 4 != 0:
	n = m + j
	j += 1
	suma = 0
	for i in range(len(str(n))):
		suma += int(str(n)[len(str(n)) - 1])
		n = n // 10
n = m + j - 1
print(n)


n = input()
for i in range(10000):
	c = 0
	tmp = int(n) + i
	tmp = str(tmp)
	for j in tmp:
		c += int(j)
	if c % 4 == 0:
		print(tmp)
		exit()


def funct(n):
	c = []
	while n != 0:
		d = n % 10
		c.append(d)
		n = n // 10
	return c
n = int(input())
f = n
c = funct(n)
while sum(c) % 4 != 0:
	n += 1
	c = funct(n)
print(n)


a = int(input())
c = a
while True:
	l = list(str(c))
	s = 0
	for i in range(len(l)):
		s += int(l[i])
	if s % 4 == 0:
		print(c)
		break
	c += 1


a = input()
j = int(a)
s = 0
while s % 4 != 0 or s == 0:
	s = 0
	u = str(j)
	for i in range(len(u)):
		s += int(u[i])
	j += 1
print(j - 1)


def f(a):
	b = 0
	a = str(a)
	for i in range(len(a)):
		b += int(a[i])
	return b
a = int(input())
flag = 1
if f(a) % 4 == 0:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1
if f(a) % 4 == 0 and flag:
	print(a)
	flag = 0
else:
	a += 1


def sod(x):
	s = 0
	while x > 9:
		s += x % 10
		x = x // 10
	s = s + x
	return s
n = int(input())
while sod(n) % 4 != 0:
	n += 1
print(n)


a = int(input())

def is_div4(n):
	add = 0
	while n:
		add += n % 10
		n = n // 10
	return add % 4 == 0
while not is_div4(a):
	a += 1
print(a)


def interesting(n):
	m = 0
	while n > 0:
		m = m + int(n % 10)
		n = n / 10
	if m % 4 == 0:
		return True
	else:
		return False
n = int(input())
for i in range(n, n + 15000):
	if interesting(i) == True:
		print(i)
		break


n = input()
sumy = 0

def sumofd(a):
	sumy = 0
	while a:
		sumy += a % 10
		a = a // 10
	return sumy
for i in range(int(n), 1200):
	if sumofd(i) % 4 == 0:
		print(i)
		break


def isgood(x):
	res = 0
	while x:
		res += x % 10
		x //= 10
	return res % 4 == 0

def solution():
	n = int(input())
	while isgood(n) == False:
		n += 1
	print(n)
	return

def main():
	test = 1
	for i in range(test):
		solution()
	return
main()


a = int(input())
for _ in range(6):
	s = 0
	for i in str(a):
		s += int(i)
	if s % 4 == 0:
		break
	a += 1
print(a)


def sums(x):
	n = x
	sumi = 0
	while n != 0:
		sumi += n % 10
		n = n // 10
	return sumi
n = int(input())
while sums(n) % 4 != 0:
	n += 1
print(n)


def nin():
	a = int(input())
	sum = 0
	for i in range(0, len(str(a))):
		a_to_str = str(a)
		sum += int(a_to_str[i])
	if sum % 4 == 0:
		return a
	while sum % 4 != 0:
		sum = 0
		a += 1
		for i in range(0, len(str(a))):
			a_to_str = str(a)
			sum += int(a_to_str[i])
		if sum % 4 == 0:
			return a
print(nin())


a = int(input())
for i in range(a, a + 1001):
	asdf = [0] * 1000
	sm = 0
	cnt = 0
	n = i
	while n > 0:
		sm += 1
		asdf[sm] = n % 10
		cnt += asdf[sm]
		n //= 10
	if cnt % 4 == 0:
		print(i)
		exit(0)


n = input()
s = 0
while 1:
	s = 0
	for i in n:
		s += int(i)
	if s % 4 != 0:
		l = int(n)
		l += 1
		n = str(l)
	else:
		break
print(n)


def okay(n):
	s = list(str(n))
	s = list(map(int, s))
	if sum(s) % 4 == 0:
		return 0
	else:
		return 1
n = int(input())
while okay(n):
	n += 1
print(n)


def sums(n):
	s = 0
	for i in range(n):
		r = n % 10
		s += r
		n = n // 10
	return s
n = int(input())
for i in range(n + 5):
	if sums(n) % 4 == 0:
		print(n)
		break
	else:
		n += 1
		continue


def sum_of(s):
	array = list(s)
	return sum(map(lambda x: int(x), array))
in_num = input()
if sum_of(in_num) % 4 != 0:
	x = int(in_num)
	while sum_of(str(x)) % 4 != 0:
		x += 1
	print(x)
else:
	print(in_num)


def sumOfDigits(n):
	summ = 0
	for i in n:
		summ += int(i)
	return summ
import math
n = input()
while sumOfDigits(n) % 4 != 0:
	for i in range(4):
		n1 = int(n) + i
		if sumOfDigits(str(n1)) % 4 == 0:
			n = n1
			break
	sumd = sumOfDigits(str(n))
	gap = math.ceil(sumd / 4) * 4 - sumd
	n = str(int(n) + gap)
print(n)


a = input('')
for i in range(int(a), int(a) + 1000):
	s = []
	for j in range(len(str(i))):
		s.append(int(str(i)[j]))
	if sum(s) % 4 == 0:
		print(i)
		break


a = int(input())

def getsum(n):
	sum = 0
	while n != 0:
		sum = sum + int(n % 10)
		n = int(n / 10)
	return sum
for i in range(100):
	if getsum(a) % 4 == 0:
		break
	else:
		a = a + 1
print(a)


n = int(input())

def notInteresting(k):
	s = 0
	for i in str(k):
		s += int(i)
	return s % 4 == 0
k = n
while not notInteresting(k):
	k += 1
print(k)


n = int(input())
while True:
	tmp = 0
	s = str(n)
	for i in s:
		tmp += int(i)
	if tmp % 4 == 0:
		print(n)
		exit()
	n += 1


def f(x):
	return sum(map(int, str(x))) % 4 == 0
a = int(input())
for i in range(20):
	if f(a + i):
		print(a + i)
		break


def main():
	a = int(input())
	for n in range(a, a + 1000):
		s = sum(map(int, str(n)))
		if s % 4 == 0:
			print(n)
			return
main()


a = int(input())
j = 0
d = 0
i = a
if a >= 1:
	while i < 100000:
		k = str(i)
		t = list(k)
		u = len(t)
		for j in range(u):
			p = int(t[j])
			d = d + p
		v = d % 4
		if v == 0:
			print(i)
			break
		d = 0
		i = i + 1


def summa_chisel(x):
	q = [0, 0, 0, 0]
	for i in range(4):
		tmp = x - -q[0] * 1000 - q[1] * 100 - q[2] * 10 - q[3]
		q[i] = tmp // 10 ** (3 - i)
	ss = q[0] + q[1] + q[2] + q[3]
	return ss
a = int(input())
asum = summa_chisel(a)
for i in range(11):
	if summa_chisel(a + i) % 4 == 0:
		print(a + i)
		break


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	while 1:
		sm = sum((int(ch) for ch in str(n)))
		if sm % 4 == 0:
			break
		n += 1
	print(n)


import sys
n = int(next(sys.stdin))

def s(x):
	sum = 0
	while x != 0:
		sum += x % 10
		x = x // 10
	return sum
while s(n) % 4 != 0:
	n += 1
print(n)


a = int(input())
l = [int(i) for i in list(str(a))]
while sum(l) % 4 != 0:
	a += 1
	l = [int(i) for i in list(str(a))]
print(a)


n = int(input())
while 1:
	y = str(n)
	counter = 0
	for item in y:
		counter += int(item)
	if counter % 4 == 0:
		print(y)
		break
	n += 1


import sys
input = sys.stdin.readline

def digsum(x):
	s = 0
	while x > 0:
		s += x % 10
		x //= 10
	return s

def main():
	a = int(input())
	while digsum(a) % 4 != 0:
		a += 1
	print(a)
main()


n = int(input())
left = n
right = n
while sum(map(int, str(right))) % 4 != 0:
	right += 1
if sum(map(int, str(left))) % 4 == 0:
	print(left)
else:
	print(right)


def is_correct(nmb):
	if isinstance(nmb, str):
		return sum(map(int, nmb)) % 4 == 0
	else:
		return is_correct(str(nmb))
n = input()
while not is_correct(n):
	n = int(n) + 1
print(n)


n = int(input())
for i in range(n, 5 * n):
	s = 0
	l = [int(x) for x in str(i)]
	s = sum(l)
	if s % 4 == 0:
		print(i)
		break


def main():
	a = input()
	while True:
		sum = 0
		for numero in a:
			sum += int(numero)
		if sum % 4 == 0:
			break
		else:
			a = int(a)
			a += 1
			a = str(a)
	print(a)
main()


n = int(input())
ans = False
answer = None
while ans is False:
	count = 0
	for i in str(n):
		count += int(i)
	if count % 4 == 0:
		answer = n
		break
	else:
		n += 1
print(answer)


a = input()
for i in range(7):
	if sum(map(int, list(a))) % 4 == 0:
		print(a)
		break
	else:
		a = str(int(a) + 1)


i = input()
m = list(map(lambda x: int(x), list(i)))
a = sum(m)
b = int(i)
while a % 4 != 0:
	b += 1
	m = list(map(lambda x: int(x), list(str(b))))
	a = sum(m)
print(b)


n = int(input())
s = 0
p = 1
while p != 0:
	k = n
	s = 0
	while k:
		s = s + k % 10
		k = k // 10
	p = s % 4
	n = n + 1
print(n - 1)


sum = 0
n = input()
m = int(n)
a = list(n)
for i in range(len(a)):
	sum = sum + int(a[i])
while sum % 4 != 0:
	n = int(n) + 1
	n = str(n)
	a = list(n)
	sum = 0
	for j in range(len(a)):
		sum = sum + int(a[j])
print(n)


n = int(input())
ans = 0
while True:
	t = n
	sum = 0
	while t > 0:
		sum += t % 10
		t = t // 10
	if sum % 4 == 0:
		ans = n
		break
	n = n + 1
print(ans)


in_p = str(input())

def Interes_num(in_p):
	Sde = [i for i in in_p]
	sum = 0
	for i in Sde:
		sum += int(i)
	if sum % 4 == 0:
		print(int(in_p))
	else:
		Interes_num(str(int(in_p) + 1))
Interes_num(in_p)


def ok(i):
	sm = 0
	while i:
		sm += i % 10
		i //= 10
	return sm % 4 == 0
n = int(input())
for i in range(n, n + 100000000):
	if ok(i):
		print(i)
		break


def ws(n):
	sum = 0
	while n:
		sum = sum + n % 10
		n = n // 10
	return sum
n = int(input())
for i in range(n, n + 1001, 1):
	if ws(i) % 4 == 0:
		print(i)
		break


def SumDig(number):
	num_st = list(number)
	num_vector = list(map(int, num_st))
	return sum(num_vector)
st = input()
n = int(st)
while SumDig(st) % 4 != 0:
	n = n + 1
	st = str(n)
print(n)


a = 10 * int(input())

def c(a):
	b = a // 10 % 10
	arr = []
	while a > 0:
		b = a // 10 % 10
		arr.append(b)
		a = a // 10
	return sum(arr)
while c(a) % 4 != 0:
	a = a + 10
print(a // 10)


def fun(a):
	b = [0, 0, 0, 0]
	b[0] = int(a % 10)
	s = b[0]
	for i in range(1, 4):
		a = a / 10
		b[i] = int(a % 10)
		s = s + b[i]
	if s % 4 == 0:
		return 1
	else:
		return 0
a = int(input())
for i in range(0, 8):
	if fun(a + i):
		print(a + i)
		break


is_interesting = lambda x: sum([int(i) for i in str(x)]) % 4 == 0
number = int(input())
while not is_interesting(number):
	number += 1
print(number)


n = input()
for i in range(1000000):
	st = 0
	for j in str(int(n) + i):
		st += int(j)
	if st % 4 == 0:
		print(int(n) + i)
		break


def sum(n):
	s = 0
	for i in str(n):
		s = s + int(i)
	return s

def fun(n):
	if sum(n) % 4:
		k = 4 - sum(n) % 4
		if 10 - n % 10 > k:
			print(k + n)
		else:
			n = n + 10 - n % 10
			fun(n)
	else:
		print(n)
n = int(input())
fun(n)


a = int(input())
z = 0
while z == 0:
	s = 0
	b = str(a)
	for i in b:
		s += int(i)
	if s % 4 == 0:
		print(a)
		z = 1
	else:
		a += 1


num = int(input())
flag = 0

def sumofdig(num):
	sum = 0
	num = str(num)
	for i in num:
		sum += int(i)
	return sum
while flag == 0:
	x = sumofdig(num)
	if x % 4 == 0:
		print(num)
		flag = 1
	else:
		num += 1


def sod(n):
	sumi = 0
	while n != 0:
		sumi = sumi + int(n % 10)
		n = int(n / 10)
	return sumi

def incheck(n):
	for i in range(n, 10010):
		tot = sod(n)
		if tot % 4 == 0:
			return n
		else:
			n = n + 1
n = int(input())
gor = incheck(n)
print(gor)


number = int(input())
number_check = sum(list(map(int, str(number))))
while number_check % 4 != 0:
	number += 1
	number_check = sum(list(map(int, str(number))))
print(number)


a = int(input())
x = True
while x == True:
	y = 0
	u = a
	for i in range(len(str(a))):
		y += u % 10
		u //= 10
	if y % 4 == 0:
		print(a)
		break
	else:
		a += 1


def is_divisible_by_4(s):
	s = str(s)
	sum_ = 0
	for i in s:
		sum_ += int(i)
	if sum_ % 4 == 0:
		return True
	return False
a = int(input())
while not is_divisible_by_4(a):
	a += 1
print(a)


def func(a):
	b = 0
	for i in range(0, len(a)):
		b = b + int(a[i])
	return b
a = str(input())
if func(a) == 0:
	print(a)
else:
	while func(a) % 4 != 0:
		a = str(int(a) + 1)
	print(a)


def jam(n):
	ans = 0
	for i in str(n):
		ans += int(i)
	return ans
n = int(input())
for i in range(n, 2000):
	if jam(i) % 4 == 0:
		print(i)
		exit()


x = int(input())
for i in range(100):
	n = x + i
	s = 0
	for j in str(n):
		s += int(j)
	if s % 4 == 0:
		print(n)
		break


def test():
	y = input('')
	x = int(y)
	while x >= 1001 or x <= 0:
		y = input('')
		x = int(y)
	return x

def somme(x):
	e = x // 1000
	a = (x - e * 1000) // 100
	b = (x - e * 1000 - a * 100) // 10
	c = x - e * 1000 - a * 100 - b * 10
	d = a + b + c + e
	return d
x = test()
if somme(x) % 4 == 0:
	print(x)
else:
	while somme(x) % 4 != 4:
		x += 1
		if somme(x) % 4 == 0:
			break
	print(x)


a = int(input())
str1 = str(a)
sum = 0
for i in range(len(str1)):
	sum += int(str1[i])
while sum % 4 != 0:
	a += 1
	str1 = str(a)
	sum = 0
	for i in range(len(str1)):
		sum += int(str1[i])
print(a)


def solve(n):
	ans = 0
	while True:
		for i in range(len(n)):
			ans += int(n[i])
		if ans % 4 == 0:
			print(n)
			break
		else:
			ans = 0
			n = int(n) + 1
			n = str(n)
	return
n = input()
solve(n)


def sum_digits(n):
	x = 0
	while n > 0:
		x = x + n % 10
		n = n // 10
	if x % 4 == 0:
		return True
	return False
a = int(input())
while True:
	if sum_digits(a):
		print(a)
		break
	a += 1


count = 0
n = int(input())
n1 = n
while count != 1:
	n = n1
	no = n
	sum = 0
	while n != 0:
		rem = n % 10
		sum += rem
		n = n // 10
	if sum % 4 == 0:
		count = 1
		print(no)
	else:
		n1 = n1 + 1
		continue


a = int(input())

def sumOfDigits(x):
	s = 0
	while x:
		s += x % 10
		x //= 10
	return s
for i in range(a, 10 ** 9):
	if sumOfDigits(i) % 4 == 0:
		print(i)
		break


def f(n):
	ans = 0
	while n > 0:
		ans = ans + n % 10
		n = int(n / 10)
	return ans
z = int(input())
while True:
	if f(z) % 4 == 0:
		break
	else:
		z = z + 1
print(z)


som = 0
k = int(input())
n = 0
while n != 1:
	l = [int(i) for i in str(k)]
	som = sum(l)
	if som % 4 == 0:
		print(k)
		n = 1
	k += 1


from sys import stdin, setrecursionlimit
from itertools import combinations
import collections

def get_sum_digit(num):
	num = list(map(int, list(str(num))))
	return sum(num)
a = int(stdin.readline().strip())
while get_sum_digit(a) % 4 != 0:
	a += 1
print(a)


a = int(input())
a1 = str(a)
c = 0
for i in range(len(a1)):
	c += int(a1[i])
while c % 4 != 0:
	a += 1
	a1 = str(a)
	c = 0
	for i in range(len(a1)):
		c += int(a1[i])
print(a)


from math import fmod as fd
z = int(input())
w = list(map(int, str(z)))
t = sum(w)
while fd(t, 4) != 0:
	z += 1
	w = list(map(int, str(z)))
	t = sum(w)
print(z)


n = str(input())
ans = 0
flag = True
while flag:
	for elem in n:
		ans += int(elem)
	if ans % 4 == 0:
		flag = False
		print(n)
	else:
		n = str(int(n) + 1)
		ans = 0


a = input()
f = 0

def sum(a):
	b = 0
	for j in range(len(a)):
		b += int(a[j])
	return b
while f != 1:
	if sum(a) % 4 == 0:
		f = 1
	else:
		a = str(int(a) + 1)
print(a)


import math

def a(n):
	s = 0
	for i in str(n):
		s += int(i)
	return s % 4 == 0
n = int(input())
while not a(n):
	n += 1
print(n)


def InterestingNumber():
	number = int(input())
	while sum(map(int, list(str(number)))) % 4:
		number += 1
	print(number)
InterestingNumber()


n = int(input())

def find_sum(number):
	s = 0
	while number != 0:
		s += number % 10
		number = number // 10
	return s
while find_sum(n) % 4 != 0:
	n += 1
print(n)


n = int(input())
for i in range(9):
	ans = 0
	a = n + i
	k = a
	while k != 0:
		rem = k % 10
		ans = ans + rem
		k = k // 10
	if ans % 4 == 0:
		print(a)
		break


n = int(input())
print(min([x for x in range(n, n + 7) if sum(map(int, list(str(x)))) % 4 == 0]))


a = int(input())
for i in range(a, 10000000000000000):
	sum = 0
	for j in range(len(str(a))):
		sum = sum + int(str(a)[j])
	if sum % 4 == 0:
		print(a)
		break
	else:
		a = a + 1


def sumOfDigit(n):
	tot = 0
	while n > 0:
		dig = n % 10
		tot = tot + dig
		n = n // 10
	return tot
a = int(input())
while sumOfDigit(a) % 4 != 0:
	a += 1
print(a)


import math
num = int(input())

def sumDigit(num):
	s = 0
	while num != 0:
		s += num % 10
		num = math.floor(num / 10)
	return s
while sumDigit(num) % 4 != 0:
	num += 1
print(num)


def ganaPeso(number):
	sumador = 0
	for i in range(len(number)):
		sumador += int(number[i])
	return sumador
number = input()
sumador = ganaPeso(number)
while sumador % 4 > 0:
	number = str(int(number) + 1)
	sumador = ganaPeso(number)
print(number)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
(a,) = I()
while sum([int(i) for i in str(a)]) % 4:
	a += 1
print(a)


n = int(input())
if n > 996:
	print(1003)
	exit()
for i in range(n, 1004, 1):
	d = i % 10 + i % 100 // 10 + i // 100
	if d % 4 == 0:
		print(i)
		exit()


def is_int(n):
	return sum(map(int, str(n))) % 4 == 0

def next_interesting(n):
	s = sum(map(int, str(n)))
	if s % 4 == 0:
		return n
	else:
		addition = (s // 4 + 1) * 4 - s
		n = n + addition
		return n
a = int(input())
for i in range(a, 1003 + 1):
	if sum(map(int, str(i))) % 4 == 0:
		print(i)
		break


n = int(input())
for i in range(10):
	a = n + i
	c = 0
	while a > 0:
		c += a % 10
		a = a // 10
	if c % 4 == 0:
		break
print(n + i)


def dsum(x):
	x = str(x)
	a = 0
	for i in x:
		a += int(i)
	return a
n = int(input())
while dsum(n) % 4 != 0:
	n += 1
print(n)


def fd70000000():
	a = int(input())
	b = []
	while True:
		b = list(str(a))
		c = sum(list(map(int, b)))
		if not c % 4:
			return print(a)
		else:
			a += 1
fd70000000()


def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
getI = int(input())
gh = sum_digits(getI)
if gh % 4 == 0:
	print(getI)
else:
	while gh % 4 != 0:
		getI += 1
		gh = sum_digits(getI)
	print(getI)


def find(n):
	n1 = list(map(int, str(n)))
	return sum(n1)

def main():
	n = int(input())
	while True:
		s = find(n)
		if s % 4 == 0:
			print(n)
			break
		n += 1
main()


n = int(input())
while True:
	s = sum([int(u) for u in list(str(n))])
	if s % 4 != 0:
		n += 1
	else:
		print(n)
		break


def f(a):
	p = a
	sum = 0
	while p > 0:
		j = p % 10
		sum += j
		p = p // 10
	return sum
n = int(input())
i = n
while f(i) % 4 != 0:
	if f(i) % 4 == 0:
		break
	i += 1
print(i)


def soln():

	def f(n: int) -> int:
		n = str(n)
		x = 0
		for c in n:
			x += int(c)
		return x

	def logic():
		n = int(input())
		while f(n) % 4 != 0:
			n += 1
		print(n)
	logic()
soln()


def main(a):
	while True:
		if sum(str(a)) % 4 == 0:
			break
		a = a + 1
	return a

def sum(x):
	i = 0
	index = 0
	while index < len(x):
		i = i + int(x[index])
		index = index + 1
	return i
a = int(input())
res = main(a)
print(res)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
a = rint()
b = a
while (b // 1000 + b // 100 % 10 + b // 10 % 10 + b % 10) % 4 != 0:
	b += 1
print(b)


def sum_digits(a):
	s = 0
	for i in range(len(a)):
		s += int(a[i])
	return s
a = input()
n = int(a)
while True:
	if sum_digits(str(n)) % 4 == 0:
		print(n)
		break
	else:
		n += 1


import math

def sum(a):
	sum = 0
	for i in range(len(a)):
		sum = sum + int(a[i])
	return sum
a = input()
if sum(a) % 4 == 0:
	print(a)
while sum(a) % 4 != 0:
	a = int(a) + 1
	a = str(a)
	if sum(a) % 4 == 0:
		print(a)
		break