import java.util.*;

public class div {
    private static Scanner sc = new Scanner(System.in);
    private static Map<Integer, Integer> m = new TreeMap<>();
    private static List<Character> l = new ArrayList<>();
//    private static long sum = 0;

    public static String sortString(String inputString) {
        // convert input string to char array
        char tempArray[] = inputString.toCharArray();

        // sort tempArray
        Arrays.sort(tempArray);

        // return new sorted string
        return new String(tempArray);
    }

    public static void main(String[] args) {
        int n = sc.nextInt();
//        sc.nextLine();
//        StringBuilder s = new StringBuilder(sc.nextLine());
//        boolean f = true;
        while (true) {
            int sum = 0;
            int a = n;

            while (a > 0) {
                sum+= a % 10;
                a /= 10;
            }
            if (sum % 4 != 0) {
                n++;
            } else {
                break;
            }
        }
        System.out.println(n);
    }
}

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input % 1000 / 100;
        int d = input / 1000;
        return (a+b+c+d)%4 == 0;
    }
}

import java.util.*;
import java.io.*;

/**
 * @author kenpen
 */
public class NearestInterestingNumber
{
    public static void main(String...args)
    {
        int a = getInt();
        int ans = a;
        for (int i = 0 ; i < 100; ++i) {
            int sum = sum(a + i);
            if (sum % 4 == 0) {
                ans = a + i;
//                System.out.println(sum);
                break;
            }
        }

//        if (sum % 4 != 0) ans = a + ( 4 - sum % 4);
        System.out.println(ans);
    }

    static int sum(int a) {
        int sum = 0;
        while (a != 0) {
            sum += a % 10;
            a = a / 10;
        }
        return sum;
    }

    // ===== Printing code =====
    static StringBuilder buf = new StringBuilder();
    static int bufSize = 5000;
    static void print(String s) {print(s, false);}

    static void print(String s, boolean newLine) {
        buf.append(s);
        if (newLine) buf.append("\n");
        if (buf.length() >= bufSize) {
            System.out.print(buf);
            buf.delete(0, buf.length());
        }
    }

    static void flush() {
        System.out.print(buf);
        buf.delete(0, buf.length());
    }

    static String arrayToString(int[] arr) {
        StringBuilder sb = new StringBuilder();
        for (int a : arr) sb.append(a).append(" ");
        if (arr.length > 0) sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }

    // ===== INPUT TAKING CODE ====
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static void checkSt() {
        if (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                System.out.println("Error parsing input");
            }
        }
    }
    static int getInt() {
        checkSt();
        return Integer.valueOf(st.nextToken());
    }

    static long getLong() {
        checkSt();
        return Long.valueOf(st.nextToken());
    }

    static long getNewLineLong() {
        try {
            return Long.valueOf(br.readLine());
        } catch (IOException e) {
            System.out.println("Error parsing input");
            return 0;
        }
    }

    static int getNewLineInt() {
        try {
            return Integer.valueOf(br.readLine());
        } catch (IOException e) {
            System.out.println("Error parsing input");
            return 0;
        }
    }

    static char getChar() {
        checkSt();
        return st.nextToken().charAt(0);
    }

    static String getStr() {
        checkSt();
        return st.nextToken();
    }

}

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class A {
    static int getSum(int a) {
        int sum=0;
        while(a!=0) {
            sum+=(a%10);
            a/=10;
        }
        return sum;
    }
    public static void main(String[] args) throws Exception {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String s=br.readLine();
        int n=Integer.valueOf(s.trim());
        int a=n,sum=getSum(a);
        if((sum%4)!=0) {
            while(++n<=1003) {
                a=n;
                sum=getSum(a);
                if((sum%4)==0) {
                    pw.print(n);
                    break;
                }
            }
        }
        else {
            pw.print(n);
        }
        pw.close();
        br.close();
    }
}

import java.io.*;
import java.util.*;
public class Quest
{
    static ArrayList<Integer> al=new ArrayList<Integer>();
    static void solve()
    {
        al.add(4);
        al.add(8);
        for(int i=10;i<10000;i++)
        {
            int s=0;
            int t=i;
            while(t>0)
            {
                s+=t%10;
                t=t/10;
            }
            if(s%4==0)
            al.add(i);
        }
    }
    public static void main(String[] args) throws IOException
    {
        solve();
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        int m=Integer.MAX_VALUE,ans=0;
        for(int i=0;i<al.size();i++)
        {
            int d=(int)(Math.abs(n-al.get(i)));
            if(m>d&&n<=al.get(i))
            {
                m=d;
                ans=al.get(i);
            }
        }
        System.out.println(ans);
    }
}

import java.util.Scanner;
/**
 *
 * @author USER
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Scanner sc = new Scanner(System.in);

        int i = sc.nextInt();

        if (i % 3 == 0) {
            int result = check(i);
            //System.out.println(result);
            if (result % 4 == 0) {
                System.out.println(i);
            } else {
                for (int k = i; result % 4 != 0; k++) {
                    result = check(k);
                    //System.out.println(result);
                    if (result % 4 == 0) {
                        System.out.println(k);
                    }
                }
            }
        } else {
            int result = check(i);
            //System.out.println(result);
            if (result % 4 == 0) {
                System.out.println(i);
            }
            for (int k = i; result % 4 != 0; k++) {
                result = check(k);
                //System.out.println(result);
                if (result % 4 == 0) {
                    System.out.println(k);
                }

            }
        }
    }
            public static int check(int z){
                int sum=0;
                while(z>0){
                    int n=z%10;
                    sum+=n;
                    z=z/10;
                }
                return sum;
            }
    }

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int res = n;
      //System.out.println(sum(n+3));
      if(sum(n)%4==0){
          System.out.println(res);
      }
      else{
          int ans =0;
          for(int i=1;i<=100;i++){
              if(sum(i+n)%4 == 0){
                  System.out.println(i+n);break;
              }
          }
      }
    }
    static int sum(int n){
        int su=0,m=0;
        while(n>0)
        {
        m=n%10;
        su=su+m;
        n=n/10;
        }
        return su;
    }
}

import java.util.*;
import java.io.*;

public class Main {
	static long mod = 1000000007;
	static int INF = 1000000000;
 	public static void main(String[] args){
		FastScanner scanner = new FastScanner();
		int a = scanner.nextInt();
		int[] b = new int[10];
		for(int i = 0; i < 10; i++){
			b[i] = a+i;
		}
		int[] c = new int[10];
		for(int i = 0; i< 10; i++){
			c[i] = b[i];
		}
		int[] sum = new int[10];
		for(int i = 0; i < 10; i++){
			while(b[i] > 0){
				sum[i] += b[i]%10;
				b[i] /= 10;
			}
		}

		for(int i = 0; i < 10; i++){
			if(sum[i]%4==0){
				System.out.println(c[i]);
				return;
			}
		}
	}
	static class Pair implements Comparable<Pair>{
    int first, second;
    Pair(int a, int b){
        first = a;
        second = b;
    }
    @Override
    public boolean equals(Object o){
        if (this == o) return true;
        if (!(o instanceof Pair)) return false;
        Pair p = (Pair) o;
        return first == p.first && second == p.second;
    }
    @Override
    public int compareTo(Pair p){
        //return first == p.first ? second - p.second : first - p.first; //firstで昇順にソート
        //return (first == p.first ? second - p.second : first - p.first) * -1; //firstで降順にソート
        //return second == p.second ? first - p.first : second - p.second;//secondで昇順にソート
        //return (second == p.second ? first - p.first : second - p.second)*-1;//secondで降順にソート
		    //return first * 1.0 / second > p.first * 1.0 / p.second ? 1 : -1; // first/secondの昇順にソート
		    //return first * 1.0 / second < p.first * 1.0 / p.second ? 1 : -1; // first/secondの降順にソート
				//return second * 1.0 / first > p.second * 1.0 / p.first ? 1 : -1; // second/firstの昇順にソート
		    //return second * 1.0 / first < p.second * 1.0 / p.first ? 1 : -1; // second/firstの降順にソート
				//return Math.atan2(second, first) > Math.atan2(p.second, p.first) ? 1 : -1; // second/firstの昇順にソート
				//return first + second > p.first + p.second ? 1 : -1; //first+secondの昇順にソート
				//return first + second < p.first + p.second ? 1 : -1; //first+secondの降順にソート
				return first - second < p.first - p.second ? 1 : -1; //first-secondの降順にソート
		}
  }

	private static class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
				if (ptr < buflen) {
						return true;
				}else{
						ptr = 0;
						try {
								buflen = in.read(buffer);
						} catch (IOException e) {
								e.printStackTrace();
						}
						if (buflen <= 0) {
								return false;
						}
				}
				return true;
		}
		private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
		private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
		public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
		public String next() {
				if (!hasNext()) throw new NoSuchElementException();
				StringBuilder sb = new StringBuilder();
				int b = readByte();
				while(isPrintableChar(b)) {
						sb.appendCodePoint(b);
						b = readByte();
				}
				return sb.toString();
		}
		public long nextLong() {
				if (!hasNext()) throw new NoSuchElementException();
				long n = 0;
				boolean minus = false;
				int b = readByte();
				if (b == '-') {
						minus = true;
						b = readByte();
				}
				if (b < '0' || '9' < b) {
						throw new NumberFormatException();
				}
				while(true){
						if ('0' <= b && b <= '9') {
								n *= 10;
								n += b - '0';
						}else if(b == -1 || !isPrintableChar(b)){
								return minus ? -n : n;
						}else{
								throw new NumberFormatException();
						}
						b = readByte();
				}
		}
		public int nextInt() {
				long nl = nextLong();
				if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
				return (int) nl;
		}
		public double nextDouble() { return Double.parseDouble(next());}
	}
}

import java.util.*;

public class Solution {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int n = sc.nextInt();
    while (true) {
      int temp = n;
      int sum = 0;
      while (temp > 0) {
        sum += temp % 10;
        temp /= 10;
      }
      if (sum % 4 == 0) {
        System.out.println(n);
        return;
      }
      n++;
    }
  }

}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class NearestInterestingNumber {
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    long L_INF = (1L << 60L);

    void solve() {
        int n=ni(),sum, m;
        for (int i = n; ; i++) {
            m=i;
            sum=0;
            while (m>0){
                sum+=m%10;
                m/=10;
            }
            if(sum%4==0) {
                pw.println(i);
                break;
            }
        }
    }

    void run() throws Exception {
        //		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        is = System.in;
        pw = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
//        int t = ni();
//        while (t-- > 0)
            solve();
        pw.flush();
        tr(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new NearestInterestingNumber().run();
    }

    private byte[] inbuf = new byte[1024];
    private int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) {
        if (!oj) System.out.println(Arrays.deepToString(o));
    }
}

import java.util.Scanner;

public class NearestInterestingNumber
{
    public static void main( String [] args )
    {
        Scanner input = new Scanner( System.in );

        int n = input.nextInt();

        while( ( n / 1000 % 10 + n / 100 % 10 + n / 10 % 10 + n % 10 ) % 4 != 0 )
            n ++;

        System.out.println( n );
    }
}

import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class InterestingNumber {
  private static boolean isInteresting(int n){
    int sum = 0;
    while(n>0){
      sum+=n%10;
      n/=10;
    }
    return sum%4==0;
  }

  private static int nextInterestingNum(int n){
    if(isInteresting(n)) return n;
    return nextInterestingNum(n+1);
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int input = sc.nextInt();
    System.out.println(nextInterestingNum(input));
    sc.close();
  }
}

import java.util.*;
public class JavaApplicationM{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);

//----------------------------------------------
int n=in.nextInt(),y=0;
String s=String.valueOf(n);
for(int i=0;i<s.length();i++)
{
  y=y+Integer.valueOf(String.valueOf(s.charAt(i)));
}
if(y%4==0){ System.out.print(n);}
else
{
while(y%4!=0)
{
 y=0;
 n++;
 s=String.valueOf(n);
 for(int i=0;i<s.length();i++)
 {
  y=y+Integer.valueOf(String.valueOf(s.charAt(i)));
 }

}
 System.out.print(n);
}

}}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class CF_1183_A
{

    public static int nSum(int val){
        int sum = 0;
        while(val != 0){
            sum += val %10;
            val = val /10;
        }
        return sum;

    }
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
//        int testCount = Integer.parseInt(in.next());
////        for (int i = 1; i <= testCount; i++)
////            solver.solve(i, in, out);

        int n = Integer.parseInt(in.next());
        while (true){

            if(nSum(n)%4 ==0 ){
                out.println(n);
                break;
            }
            n ++;
        }
        out.close();
    }

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            BigInteger a = new BigInteger(in.next());
            BigInteger b = new BigInteger(in.next());
            BigInteger c = new BigInteger(in.next());

            BigInteger largest  =a.max(b.max(c));
            BigInteger smallest = a.min(b.min(c));

            BigInteger middle = a.add(b).add(c).subtract(largest).subtract(smallest);
            out.println(middle.add((largest.subtract(middle.subtract(smallest)).divide(new BigInteger("2")))));

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        ArrayList<Integer> nums = new ArrayList<>();
        int copy = a;
        int sum = 0;

        while (true){

            while (copy > 0) {
                int last = copy % 10;
                sum += last;
                copy /= 10;
            }
            if(sum%4==0){
                break;
            }else{
                a++;
                copy=a;
                sum=0;
            }

        }
        System.out.println(a);
    }

            }
//

import java.util.*;
public class java
{
    public static void main(String args[])
    {
            Scanner in=new Scanner(System.in);
            long n,a,num,rem,num1,s=0;
            a=in.nextLong();
            num=a;
            for(n=num;n>=a;n++,num++)
            {
                num1=n;
                s=0;
                rem=0;
                while(num1!=0)
                {
                    rem=num1%10;
                    s=s+rem;
                    num1=num1/10;
                }
                if(s%4==0)
                {
                    System.out.println(n);
                    System.exit(0);
                }
            }
        }
    }

import java.util.Scanner;

public class JavaApplication32 {

    public static void main(String[] args) {
        Scanner sc=new Scanner (System.in);
        int a=sc.nextInt();
        while (a!=0){
            int n=a;
            int sum=0;
            while(a!=0){
                sum+=a%10;
                a/=10;
            }
            if(sum%4==0){
                System.out.println(n);
            break;
            }
            else {
                a=n;
                a++;
            }
        }
    }

}

import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import java.util.HashMap;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class A1183 {
	static boolean GOT = false;
	static void solve(long time) throws IOException {
		int a = nextInt();
        int i = a;
        while(true) {
            if(rem(i)) {
                println(i);
                return;
            }
            ++i;
        }
	}

    static boolean rem(int a) {
        String s = String.valueOf(a);
        int n = 0;
        for(int i = 0; i < s.length(); ++i) {
            n += Integer.parseInt(String.valueOf(s.charAt(i)));
        }
        return n % 4 == 0;
    }

	public static void main(String[] sargs) throws IOException {
		long t = 1;
		if(GOT)
			t = nextLong();
		for(long nr = 1; nr <= t; ++nr)
			solve(nr);
		out.flush();
	}

	static Scanner sc = new Scanner(System.in);
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out = new PrintWriter(System.out);

	//I/O functions...
	static String next() {
		return sc.next();
	}

	static String nextLine() throws IOException {
		return br.readLine();
	}

	static int nextInt() {
		return sc.nextInt();
	}

	static long nextLong() {
		return sc.nextLong();
	}

	static float nextFloat() {
		return sc.nextFloat();
	}

	static double nextDouble() {
		return sc.nextDouble();
	}

	static BigInteger nextBigInteger() {
		return sc.nextBigInteger();
	}

	static void print(Object...o) {
		if(o[o.length - 1].toString().equals(" "))
			for(int i = 0; i < o.length; ++i)
				out.print(o[i].toString() + " ");
		else
			for(int i = 0; i < o.length; ++i)
				out.print(o[i].toString());
	}

	static void println(Object...o) {
		if(o.length < 1) {
			out.println();
			return;
		}
		for(int i = 0; i < o.length; ++i)
			out.println(o[i].toString());
	}

	//some math functions
	static int min(int...n) {
		int res = 2147483647;
		for(int i = 0; i < n.length; ++i)
			res = Math.min(n[i], res);
		return res;
	}

	static int max(int...n) {
		int res = -2147483648;
		for(int i = 0; i < n.length; ++i)
			res = Math.max(n[i], res);
		return res;
	}

	static int abs(int n) {
		return Math.abs(n);
	}

	static long pow(int a, int b) {
		return (long)Math.pow(a, b);
	}
}

//Codeforces 1183A
import java.util.Scanner;

public class CF1183A {
    static final Scanner SC = new Scanner(System.in);
    public static void main(String[] args) {
        int num = SC.nextInt();
        int digitSumDivBy4 = getDigitSumDivBy4(num);
        System.out.println(digitSumDivBy4);
    }

    // Computes and returns same/next number divisible by 4
    static int getDigitSumDivBy4(int num) {
        int digitSum = getDigitSum(num);
        if (digitSum % 4 == 0)
            return num;
        else
            return getDigitSumDivBy4(num+1);
    }

    // Computes and returns sum of digits
    static int getDigitSum(int num) {
        int sum = 0;
        while (num > 0) {
            sum += num % 10;
            num /= 10;
        }
        return sum;
    }
}

import java.util.*;
import java.io.*;

public class NearInterestingNumber{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int num = Integer.parseInt(br.readLine());

		int sum = 0;

		int i = 0;

		int temp = num;

		int lastDigit = num%10;

		while(num != 0){

			sum += num%10;
			num /= 10;
		}

		if((sum%4) == 0){
				System.out.println(temp);
		}
		else{

				while(true){
					++temp;

					int temp2 = temp;

					sum = 0;
					while(temp2 != 0){

						sum += temp2%10;
						temp2 /= 10;
					}
					if((sum%4) == 0){
						System.out.println(temp);
						break;
					}

				}
			}

		}
	}

import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.security.KeyStore.Entry;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.net.ssl.SSLContext;

public class Main
{
   static long mod=(long)(1e+9 + 7);
   static int[] sieve;
   static ArrayList<Integer> primes;
   static int[] visited;

   public static void main(String[] args) throws java.lang.Exception
   {
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);
	     Scanner sc=new Scanner(System.in);
	     StringBuilder fans = new StringBuilder();

	     int n=s.nextInt();
	     int ans=0;

	     for(int i=n;i<=n+1000;i++)
	    	 {
	    		 int temp=i;
	    		 int sum=0;

	    		 while(temp>0)
	    			 {
	    				 sum=sum+temp%10;
	    				 temp/=10;
	    			 }

	    		 if(sum%4==0)
	    			 {ans=i;break;}
	    	 }

	     System.out.println(ans);

   }

static class fast {
	private InputStream i;
		private byte[]  buf = new byte[1024];
		private int curChar;
		private int numChars;

		//Return floor log2n
		public static long log2(long bits) // returns 0 for bits=0
			{
			    int log = 0;
			    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
			    if( bits >= 256 ) { bits >>>= 8; log += 8; }
			    if( bits >= 16  ) { bits >>>= 4; log += 4; }
			    if( bits >= 4   ) { bits >>>= 2; log += 2; }
			    return log + ( bits >>> 1 );
			}

		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;
			   int n=a.length;

			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;

			   if(index==-1) return false;
			   i=index;

			   for(j=i+1;j<n && a[i]<a[j];j++);

			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;

			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }

			   return true;
		   }

		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;

			   }
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);
			   System.out.println(quotient+" "+remainder);
		   }

		public static void sieve(int size)
		{
			sieve=new int[size+1];

			primes=new ArrayList<Integer>();

			sieve[1]=1;

			for(int i=2;i<=Math.sqrt(size);i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
				 }
			}

			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}

		public static long pow(long n, long b, long MOD)
		   {
		       long x=1;long y=n;
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD);
		           b >>= 1;
		       }
		       return x;
		   }

		public static long mod_inv(long n,long mod)
		{
			return pow(n,mod-2,mod);
		}

		 public static int upper(long[] a,int length,long key)
		 {
			    int low = 0;
		        int high = length-1;
		        int ans=-1;

		        while (low <= high) {
		            int mid = (low + high) / 2;
		            if (key >= a[mid]) {
		                ans=mid;
		            	low = mid+1;
		            } else if(a[mid]>key){
		                high = mid - 1;
		            }
		        }
		        return ans;
		}

		 public static int lower(long[] a,int length,long key)
		 {
			    int low = 0;
		        int high = length-1;
		        int ans=-1;

		        while (low <= high) {
		            int mid = (low + high) / 2;
		            if (key<=a[mid]) {
		                ans=mid;
		            	high = mid-1;
		            }
		            else{
		            		low=mid+1;
		            	}
		        }
		        return ans;
		}

		public long gcd(long r,long ans)
		{
			if(r==0) return ans;
			return gcd(ans%r,r);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
}

import java.io.*;
import java.util.*;
public class NearestInterestingNumber
{
    public static void main(String[] f)
    {
        int T,N,M,sumdigi=0,x;
        Scanner sc=new Scanner(System.in);
        N=sc.nextInt();
        while(true)
		{
			sumdigi=0;
			M=N;
        while(M!=0)
        {
            sumdigi+=(M%10);
            M/=10;
        }
		if(sumdigi%4==0)
		{
			System.out.println(N);
			break;
		}
		N++;
		}
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ANearestInterestingNumber solver = new ANearestInterestingNumber();
        solver.solve(1, in, out);
        out.close();
    }

    static class ANearestInterestingNumber {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int x = sc.nextInt();
            int clone = x;
            int sum = 0;
            while (clone != 0) {
                sum += clone % 10;
                clone /= 10;
            }
            sum %= 4;
            while (sum != 0) {
                x++;
                clone = x;
                sum = 0;
                while (clone != 0) {
                    sum += clone % 10;
                    clone /= 10;
                }
                sum %= 4;
            }
            pw.println(x);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
public class Answer {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t;
		t=sc.nextInt();
		for(int i=t;;i++) {
			if(sod(i)%4==0) {
				System.out.println(i);
				break;
			}

		}
	}
	public static int sod(int n) {
		int sum=0;
		while(n>0) {
			sum+=n%10;
			n=n/10;
		}
		return sum;
	}

}

import java.io.*;
import java.util.*;
public class interesting_num{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        while(sum(a)%4!=0){
            a++;
        }
        System.out.println(a);
    }
    public static int sum(int a){
        int result=0;
        while(a>0){
            result+=a%10;
            a/=10;
        }
        return result;
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,j,m=0,k,p=0,h,l,x,y,d;
		String s,st;
		for(i=0;i<t;i++)
		{
		    m=0;
		    n=in.nextInt();
		    d=n;
		    while(n>0)
		    {
		         x=n%10;
		         m+=x;
		         n=n/10;
		    }
		    if(m%4==0)
		    System.out.println(d);
		    else
		    {
		        for(j=d+1;;j++)
		        {
		            m=0;d=j;
		            while(d>0)
		            {
		                x=d%10;
		                m=m+x;
		                d=d/10;
		            }
		            if(m%4==0)
		            {
		            System.out.println(j);
		            break;
		            }
		        }
		    }
		}
	}
}

	import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Scanner {

		BufferedReader br;
		StringTokenizer st;
		Scanner()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() throws IOException
		{
			while(st == null ||  !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}
		long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
		public static void main(String[] args) throws IOException {

			Scanner sc = new Scanner();
			int t = sc.nextInt();
			int count = 0;
			for(int i=0;i<1000;i++)
			{
				count = solve((t + i));
				if(count%4==0)
				{
					System.out.println((t+i));
					break;
				}
			}
		}
		static int solve(int n)
		{
			int sum = 0;
			while(n > 0)
			{
				sum +=n % 10;
				n = n/10;
			}
			return sum;
		}

	}

import java.util.Scanner;
import java.io.PrintWriter;

public class abb{
	private static Scanner sc = new Scanner(System.in);
	public static int sum(int temp){
	    int sum=0;
	    while(temp>0){
	        sum+=temp%10;
	        temp=temp/10;
	    }
	    return sum;
	}
	public static void main(String[] args) {
	    int numOfBlocks = sc.nextInt();
	    int sumVal=sum(numOfBlocks);
	    while(sumVal%4!=0){
	        numOfBlocks++;
	        sumVal=sum(numOfBlocks);
	    }
	    System.out.println(numOfBlocks);
	    }
}

import java.util.Scanner;
public class Interesting_no {

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int no = sc.nextInt();
        while(true)
        {
            int sum = 0;
            int tno = no;
            while(tno>0)
            {
                int d = tno%10;
                tno = tno/10;
                sum+=d;
            }
            if(sum%4==0)
            {
                System.out.print(no);
                break;
            }
            no++;
        }
    }
}

//package CodeForces;

import java.util.Scanner;

public class NearestInterstingProb {

	static int getSum(int x)
	{
		int temp=0;
		while(x>0)
		{
			temp=temp+x%10;
			x=x/10;
		}
		return temp;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int temp=getSum(n);
		while(temp%4!=0)
		{
			n++;
			temp=getSum(n);
		}
		System.out.println(n);

	}

}

import java.util.Scanner;

public final class SumInterest {
public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
	if(a<4)
		System.out.println("4");
	else {
	int sum=0;
	for(int i=a;i<a*a;i++)
	{
		sum=sum(i);
		if(sum%4==0)
		{
			System.out.println(i);
			break;
		}
	}
	}
}
static int sum(int a)
{
	int sum=0;
	while(a>0)
	{
		sum=sum+a%10;
		a/=10;
	}
	return sum;
}
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;

public class Main1{
	static long mod = 1000000007;
	static InputReader in = new InputReader(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		//int t=in.readInt();
		//while(t-->0){
			int b=in.readInt();
			int p=b,z=0;
			while(p!=0) {
				int r=p%10;
				z+=r;
				p/=10;
			}
			b++;
			p=b;
			while(z%4!=0) {
				z=0;
			while(p!=0) {
				int r=p%10;
				z+=r;
				p/=10;
			}
			b++;
			p=b;
			}
			System.out.println(b-1);
			//long n=in.readLong();
			// String a=in.readString();
		//}
	}

	static String removeChar(String s,int a,int b) {
		return s.substring(0,a)+s.substring(b,s.length());
	}
	static int[]  nextIntArray(int n){
		int[] arr= new int[n];
		int i=0;
		while(i<n){
			arr[i++]=in.readInt();
		}
		return arr;
	}
	static long[] nextLongArray(int n){
		long[]arr= new long[n];
		int i=0;
		while(i<n){
			arr[i++]=in.readLong();
		}
		return arr;
	}
	static int[]  nextIntArray1(int n) {
		int[] arr= new int[n+1];
		int i=1;
		while(i<=n){
			arr[i++]=in.readInt();
		}
		return arr;
	}
	static long[] nextLongArray1(int n){
		long[]arr= new long[n+1];
		int i=1;
		while(i<=n) {
			arr[i++]=in.readLong();
		}
		return arr;
	}
	static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}
	static long pow(long n, long m) {
		if(m==0)
			return 1;
		else if(m==1)
			return n;
		else {
			long r=pow(n,m/2);
			if(m%2==0)
				return r*r;
			else
				return r*r*n;
		}
	}
	static long max(long a,long b,long c) {
		return Math.max(Math.max(a, b),c);
	}
	static long min(long a,long b,long c) {
		return Math.min(Math.min(a, b), c);
	}
	static class Pair implements Comparable<Pair> {
		int a, b;
		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}
		public int compareTo(Pair o) {
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
			// return 0;
		}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}
		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public String next() {
			return readString();
		}
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
public class codeforces
{
    public static void main (String[] args)
    {

        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        while(true){
            int sum = 0;
            int a = n;
            while(a>0){
                sum+=a%10;
                a/=10;
            }
            if(sum%4==0){
                System.out.println(n);
                break;
            }
            n++;
        }

    }
}

import java.util.ArrayList;
import java.util.Scanner;
import java.lang.Math;

public class Newq {

    static boolean digSUm(int t){
        int sum=0;
        while (t != 0) {
            sum=sum+(t%10);
            t=t/10;
        }

        if (sum%4==0){
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();

        int i=0;
        while(true){
            if (digSUm(n+i)){
                System.out.println(n+i);
                break;
            } else {
                i++;
            }
        }
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);
        int x=r.nextInt();
        while (true){
            String m=String.valueOf(x);
            double y=0;
            for (int i = 0; i <m.length() ; i++) {
                y+=Integer.parseInt(String.valueOf(m.charAt(i)));
            }
            if(y%4 ==0){
                System.out.println(x);
                return;
            }
            x++;
        }
    }
}

//package round_570;

import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        while (!find(a)) {
            a++;
        }
        System.out.println(a);
    }

    public static boolean find(int a) {

        int count = 0;
        while (a!=0){
            count=count+a%10;
            a=a/10;
        }

        return count % 4 == 0;
    }
}

import java.util.*;

public class nearestInterestingNumber {

static int getSum(int val){
    int sum=0;

    while(val>0){
        sum+=val%10;
        val=val/10;
    }
    return sum;
}

static int getInterestingNumber(int a){
    int val=a;

    while(getSum(a)%4!=0){
        a++;
    }
    return a;
}

public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int ans=getInterestingNumber(a);
System.out.println(ans);

}

}

import java.util.*;

public class Main{

public static void main(String[] args) {

Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
while(true){
    int temp = n;
    int sum = 0;
    while(temp!=0){
        int c = temp%10;
        sum+= c;
        temp/=10;
    }
    if(sum%4 == 0){
        System.out.println(n);
        return;
    }
    n++;
}

 }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;

public class ProblemB {
	public static void main(String [] args) throws IOException{
	solve();	}

public static void solve() throws IOException {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	String x= a+"";
	int sum=0;
	while(true) {
		for(int i=0;i<x.length();i++) {
			sum+= Integer.parseInt(x.charAt(i)+"");
		}
		if(sum%4==0) {
			System.out.println(a);break;
		}
		a++;
		x=a+"";
		sum=0;
	}

}

static void shuffle(int[] a)
{
	int n = a.length;
	for(int i = 0; i < n; i++)
	{
		int r = i + (int)(Math.random() * (n - i));
		int tmp = a[i];
		a[i] = a[r];
		a[r] = tmp;
	}
}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {return Long.parseLong(next());}

				public String nextLine() throws IOException {return br.readLine();}

				public double nextDouble() throws IOException
				{
					String x = next();
					StringBuilder sb = new StringBuilder("0");
					double res = 0, f = 1;
					boolean dec = false, neg = false;
					int start = 0;
					if(x.charAt(0) == '-')
					{
						neg = true;
						start++;
					}
					for(int i = start; i < x.length(); i++)
						if(x.charAt(i) == '.')
						{
							res = Long.parseLong(sb.toString());
							sb = new StringBuilder("0");
							dec = true;
						}
						else
						{
							sb.append(x.charAt(i));
							if(dec)
								f *= 10;
						}
					res += Long.parseLong(sb.toString()) / f;
					return res * (neg?-1:1);
				}

				public boolean ready() throws IOException {return br.ready();}
	}

}

import java.io.*;
import java.util.*;
import java.lang.*;

public class GFG {
	public static void main (String[] args) {
	PrintWriter pw=new PrintWriter(System.out);
	Scanner sc=new Scanner(System.in);
	//int n=sc.nextInt();
	String s1=sc.next();
	int sum=0,sum1=0,r=0;
		String s=s1;
	while(true){

	for(int i=0;i<s.length();i++)
    sum+=(int)s.charAt(i)-48;
    if(sum%4==0)
    break;
	     r=Integer.parseInt(s)+1;
	    s=null;
	    s=Integer.toString(r);
	    sum=0;
	}
	pw.print(s);
	pw.close();
	}
}

import java.util.Deque;
import java.util.Scanner;

public class CF4
{
    public static void main(String[]args)
    {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        while(!sumDigits(a))
        {
            a++;
        }
        System.out.println(a);
    }

    private static boolean sumDigits(int a) {
        int sum = 0;
        while(a >= 10)
        {
            sum += a % 10;
            a /= 10;
        }
        sum += a;
        return sum % 4 == 0;
    }
}

import java.util.Scanner;

public class NearestIntresting {
//    int sum(int a)
//    {
//        for(int i=0;i<12;i++)
//       {a=a+i;
//        int c=a%10;
//        int d=a/10;
//
//        if((c+d+i)%4==0)
//          {
//           System.out.println(a+i);
//           System.exit(0);
//       }
//       }return a;
//    }
    public static void main(String[] args) {
   Scanner sc=new Scanner(System.in);

   int a=sc.nextInt();
   if(a>97&&a<100)
   {
        System.out.println("103");
   }
   if(a<=97)
   { for(int i=0;i<12;i++)
       {
   int x=a+i;
       int c=x%10;
       int d=x/10;
           if((c+d)%4==0)
       {
           System.out.println(x);
           System.exit(0);
       }

      }

   }
   else if(a>99&&a<997){
       for(int i=0;i<12;i++)
       {
      int y=a+i;
       int c=y%10;
       int d=((y%100)-c)/10;
       int e=y/100;
       if((e+c+d)%4==0)
       {
           System.out.println(y);
           System.exit(0);
       }

   }
   }
   else if(a>=997)
       {
           System.out.println(1003);
       }

}

}

import java.io.*;
import java.sql.Array;
import java.util.*;

public class test {
	/*
	 * array list
	 *
	 * ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers
	 *
	 * BigInteger a=new BigInteger(); BigInteger b=new BigInteger();
	 *
	 * hash map
	 *
	 * HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>(); for(int
	 * i=0;i<ar.length;i++) { Integer c=hm.get(ar[i]); if(hm.get(ar[i])==null) {
	 * hm.put(ar[i],1); } else { hm.put(ar[i],++c); } }
	 *
	 * while loop
	 *
	 * int t=sc.nextInt(); while(t>0) { t--; }
	 *
	 * array input
	 *
	 * int n = sc.nextInt(); int ar[] = new int[n]; for (int i = 0; i < ar.length;
	 * i++) { ar[i] = sc.nextInt(); }
	 */

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static class Pair {
		int first, second;

		public Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}

	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i] + " ");
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}

		public void flush() {
			writer.flush();
		}

	}

	private static final Scanner sc = new Scanner(System.in);
	private static final FastReader fs = new FastReader();
	private static final OutputWriter op = new OutputWriter(System.out);

	static int getsum(int i) {
		int sum = 0;
		while (i > 0) {
			sum += i % 10;
			i = i / 10;
		}
		return sum;
	}

	public static void main(String[] args) {
		int n = sc.nextInt();
		int i = n;
		for (;; i++) {
			if (getsum(i) % 4 == 0) {
				break;
			}
		}
		System.out.println(i);
	}

}/* till here */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{
	public static int findSum(int n){
		int sum = 0;
		while(n > 0){
			int x = n%10;
			sum += x;
			n /= 10;
		}
		return sum;
	}
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		while(findSum(a)%4 != 0){
			a++;
		}
		System.out.println(a);
	}
}

import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int a=scan.nextInt();
	int n=a;

	for(n=a;n<=a+6;n++){
	    int digsum=0;
	    for(int k=n;k>0;k/=10){
		digsum += k%10;
	    }
	    if(digsum%4==0) break;
	}
	System.out.println(n);
    }
}

import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int a=scan.nextInt();
	int n=a;

	for(n=a;n<=a+7;n++){
	    int digsum=0;
	    for(int k=n;k>0;k/=10){
		digsum += k%10;
	    }
	    if(digsum%4==0) break;
	}
	System.out.println(n);
    }
}

import java.util.*;

public class nearestInteresting {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();

    for (int x = a; x < 5*a; x++) {
      int sum = 0;
      int temp = x;
      while (temp > 0) {
        sum = sum + (temp % 10);
        temp = temp/10;
      }
      if (sum % 4 == 0) {
        System.out.println(x);
        break;
      }
    }
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
import java.io.Closeable;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.Flushable;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	static class TaskAdapter implements Runnable {
		@Override
		public void run() {
			InputStream inputStream = System.in;
			OutputStream outputStream = System.out;
			Input in = new Input(inputStream);
			Output out = new Output(outputStream);
			ANearestInterestingNumber solver = new ANearestInterestingNumber();
			solver.solve(1, in, out);
			out.close();
		}
	}

	public static void main(String[] args) throws Exception {
		Thread thread = new Thread(null, new TaskAdapter(), "", 1<<29);
		thread.start();
		thread.join();
	}
	static class ANearestInterestingNumber {
		public ANearestInterestingNumber() {
		}

		public boolean valid(int x) {
			String s = Integer.toString(x);
			int sum = 0;
			for(int i = 0; i<s.length(); i++) {
				sum += s.charAt(i)-'0';
			}
			return sum%4==0;
		}

		public void solve(int kase, Input in, Output pw) {
			int a = in.nextInt();
			for(int i = a; ; i++) {
				if(valid(i)) {
					pw.println(i);
					return;
				}
			}
		}

	}

	static class Input {
		BufferedReader br;
		StringTokenizer st;

		public Input(InputStream is) {
			this(is, 1<<20);
		}

		public Input(InputStream is, int bs) {
			br = new BufferedReader(new InputStreamReader(is), bs);
			st = null;
		}

		public boolean hasNext() {
			try {
				while(st==null||!st.hasMoreTokens()) {
					String s = br.readLine();
					if(s==null) {
						return false;
					}
					st = new StringTokenizer(s);
				}
				return true;
			}catch(Exception e) {
				return false;
			}
		}

		public String next() {
			if(!hasNext()) {
				throw new InputMismatchException();
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}

	static class Output implements Closeable, Flushable {
		public StringBuilder sb;
		public OutputStream os;
		public int BUFFER_SIZE;
		public boolean autoFlush;
		public String LineSeparator;

		public Output(OutputStream os) {
			this(os, 1<<16);
		}

		public Output(OutputStream os, int bs) {
			BUFFER_SIZE = bs;
			sb = new StringBuilder(BUFFER_SIZE);
			this.os = new BufferedOutputStream(os, 1<<17);
			autoFlush = false;
			LineSeparator = System.lineSeparator();
		}

		public void println(int i) {
			println(String.valueOf(i));
		}

		public void println(String s) {
			sb.append(s);
			println();
			if(autoFlush) {
				flush();
			}else if(sb.length()>BUFFER_SIZE >> 1) {
				flushToBuffer();
			}
		}

		public void println() {
			sb.append(LineSeparator);
		}

		private void flushToBuffer() {
			try {
				os.write(sb.toString().getBytes());
			}catch(IOException e) {
				e.printStackTrace();
			}
			sb = new StringBuilder(BUFFER_SIZE);
		}

		public void flush() {
			try {
				flushToBuffer();
				os.flush();
			}catch(IOException e) {
				e.printStackTrace();
			}
		}

		public void close() {
			flush();
			try {
				os.close();
			}catch(IOException e) {
				e.printStackTrace();
			}
		}

	}
}

/*==============================================
Name        : Shadman Shariar                 ||
Email       : shadman.shariar@northsouth.edu  ||
University  : North South University (NSU)    ||
Facebook    : shadman.shahriar.007            ||
==============================================*/
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner (System.in);

			int a = input.nextInt();

		 for (;;) {

			int temp = a;
			int sum =0 ;
			while(temp!=0) {
				int t = temp/10;
			    sum+= temp%10;
			    temp = t;

			}

			 if (sum%4==0) {

				 System.out.println(a);
				 break;
			 }
			 else {
				 a++;
			 }
		}
		input.close();

	}
}

import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
static int sum(int n) {
		int temp = n;
		int sum = 0;
		while(temp>0) {
			int ld = temp%10;
			sum+=ld;
			temp = temp/10;
		}
		return sum;
	}
public static void main(String[] args) {
    //solution start :-)
     Scanner sc = new Scanner(System.in);
//		int t = sc.nextInt();
//		while(t-->0) {
			int n = sc.nextInt();
//			int a[] = new int[n];
//			for(int i=0;i<n;i++) {
//				a[i] = sc.nextInt();
//			}
			if(sum(n)%4==0) System.out.println(n);
			else {
			int res1 = 0;
			for(int i=n;i<2000;i++) {
//				System.out.println("i="+i);
			  int res = sum(i);
//			  System.out.println("res="+res);
			  if(res%4==0) {res1 = i; break;}
			}
//			System.out.println(res1+"=");
			System.out.println(res1);
			}
//		}
    //solution end <-_->
}}

import java.util.Scanner;
public class CodeForces {
	public static void main (String [] args)
	{
		Scanner input = new Scanner( System.in );
		int m = input.nextInt();
		int k = m;
		int rightmost = 0;
		int sum = 0;
		while (k > 0)
		{
			rightmost = k % 10;
			sum += rightmost;
			k = k/10;
		}
		if (sum % 4 == 0)
		{
			System.out.println(m);
		}
		else if ((get_sum(m+1)) % 4 == 0)
		{
			System.out.println(m+1);
		}
		else if ((get_sum(m+2)) % 4 == 0)
		{
			System.out.println(m+2);
		}
		else if ((get_sum(m+3)) % 4 == 0)
		{
			System.out.println(m+3);
		}
		else if ((get_sum(m+4)) % 4 == 0)
		{
			System.out.println(m+4);
		}
		else if ((get_sum(m+5)) % 4 == 0)
		{
			System.out.println(m+5);
		}
		else if ((get_sum(m+6)) % 4 == 0)
		{
			System.out.println(m+6);
		}
		else if ((get_sum(m+7)) % 4 == 0)
		{
			System.out.println(m+7);
		}
		else if ((get_sum(m+8)) % 4 == 0)
		{
			System.out.println(m+8);
		}

	}
	public static int get_sum(int k)
	{
		int rightmost = 0;
		int sum = 0;
		while (k > 0)
		{
			rightmost = k % 10;
			sum += rightmost;
			k = k/10;
		}
		return sum;
	}
}

import java.io.*;
import java.util.StringTokenizer;
import java.util.*;
import java.math.*;
public class Solution{

    public static void main(String[] args) throws Exception {
        FastScanner cin = new FastScanner(System.in);
        int n = cin.nextInt();
        while(true)
        {
          int temp = n;
          int sum = 0;
          while(temp!=0)
          {
            int r = temp%10;
            sum+=r;
            temp = temp/10;

          }
          if(sum%4==0)
          {
            System.out.println(n);
            break;
          }
          n++;
        }
       }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
  }

import java.lang.*;
import java.util.*;
import java.io.*;
public class test
{
	Scanner sc=new Scanner(System.in);
	PrintWriter pr=new PrintWriter(System.out,true);
	public static void main(String... args)
	{
       test c=new test();
       c.prop();
	}
	public void prop()
	{
    int n,x,sum;
    n=sc.nextInt();
    sum=sum_digit(n);
     for ( ;sum%4!=0 ; ) {
       n=n+1;
        sum=sum_digit(n);
   }

      pr.println(n);

  }
  public int sum_digit(int n)
  {
    int sum=0 ;
    for ( ;n!=0 ; ) {
       sum+=n%10 ;
       n=n/10 ;
     }
     return sum ;
  }

}

import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int a = in.nextInt();

        for(int i=0; ; i++) {

            if(isInteresting(a+i)) {
                System.out.println(a+i);
                break;
            }

        }

    }
    private static boolean isInteresting(int n) {

        int sum = 0;

        while(n > 0) {
            sum+= n%10;
            n/=10;
        }

        if(sum%4==0) {
            return true;
        }
        return false;
    }
}

import java.util.ArrayList;
import java.util.Scanner;

public class ATD {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int nn = n;
        ArrayList<Integer> arr = new ArrayList<Integer>();
        int counter = 0;
        while (n >= 1) {
            arr.add(n % 10);
            counter += n % 10;
            n /= 10;
        }
        if (counter % 4 == 0) {
            System.out.println(nn);
            return;
        }
        arr.add(arr.size(), 0);
        while (counter % 4 != 0) {
            if (arr.get(0) == 9) {
                arr.remove(0);
                arr.add(0, 0);
                counter -= 9;
                for (int i = 1; i < arr.size(); i++) {
                    if (arr.get(i) == 9) {
                        counter -= 9;
                        arr.remove(i);
                        arr.add(i, 0);
                    } else {
                        arr.add(i, arr.get(i) + 1);
                        counter++;
                        arr.remove(i + 1);
                        break;
                    }
                }
            }
            if (counter%4 == 0)
                break;
            counter++;
            arr.add(0, arr.get(0) + 1);
            arr.remove(1);
        }
        if (arr.get(arr.size() - 1) != 0) {
            for (int i = arr.size() - 1; i >= 0; i--) {
                System.out.print(arr.get(i));
            }
        }
        else
            for (int i = arr.size() - 2; i >= 0; i--) {
                System.out.print(arr.get(i));
            }

    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		while(true){
		    if(check(n))break;
		    n++;
		}
		System.out.println(n);
	}
	public static boolean check(int n){
	    int sum =0;
	    while(n>0){
	        sum+=n%10;
	        n/=10;
	    }
	    return sum%4==0;
	}
}

/*
    by Fuzious
    21/6/2019
*/

import java.io.*;
import java.util.*;

public class codeforces {
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        int  TC=sc.nextInt();
//        for (int tc = 0; tc < TC; tc++) {
//
//        }
        while (sum(""+TC)%4!=0){
            ++TC;
        }
        out.println(TC);
        out.close();
    }
    static int sum(String a) {
        int sm=0;
        int x=Integer.parseInt(a);
        while (x>0){
            sm+=x%10;
            x=x/10;
        }
        return sm;
    }
    static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    static int mod = 1000000000 + 7;

    static class InputReader  {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public double nextDouble() {
            return (Double.parseDouble(readString()));
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.util.*;
public class problem1 {
	public static int convert(int a) {
		int sum=0;
		int temb=a;
		while(temb!=0) {
			sum+=temb%10;
			temb=temb/10;
		}
		return sum;
	}
	public static int search(int a) {
		int sum=convert(a);
		if(sum%4==0) {
			return a;
		}
		else {
			return(search(a+1));
		}
	}
	public static void main(String[]args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int n=search(a);
		System.out.print(n);
	}

}

import java.util.*;
public class CodeForces {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		while(true){
			if(check(n))break;
			n++;
		}
		System.out.println(n);

	}
	public static boolean check(int n){
		int sum =0;
		while(n>0){
			sum+=n%10;
			n/=10;
		}
		return sum%4 == 0;
	}

}

/*
1.make sure to include continue or return if u are handling a specific case separately!!!!
and check the constraints of every alphabet(missed to check for case 0)!!!!!!!!!

2.when u have transitions between states and its not dp try dfs (also think of topo sort)
 */

import java.util.*;
public class number
{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        int val=0;
        for(int i=num;i<=num+16;i++)
        {
            if(sumdig(i)%4==0)
            {
                val=i;
                break;
            }
        }
        System.out.println(val);
    }
    static int sumdig(int n)
    {
        int d,s=0;
        while(n>0)
        {
            d=n%10;
            s+=d;
            n/=10;
        }
        return s;
    }
}

import java.util.Scanner;

public class JavaApplication127 {

    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);

       int x = sc.nextInt();
       int count = 0;
       while(x <= 1003){
           for(int i=x; i!=0; i=i/10){
               int r = i%10;
               count +=r;
           }
           if(count % 4 ==0){
               System.out.println(x);return;
           }
           count = 0;
           x++;

       }

    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Scanner;

/**
 *
 * @author george.michael
 */
public class Codeforces {

    /**
     * @param args the command line arguments
     */
    public static int getTheSumOfDigits(int n){
        int sum=0;
        String number  = String.valueOf(n);
          for (int i = 0; i < number.length(); i++) {
                 sum+=Integer.parseInt(number.charAt(i)+"");

        }
         return sum;
    }
    public static void main(String[] args) throws IOException {
          BufferedReader inputReader  = new BufferedReader(new InputStreamReader(System.in));
          int n = Integer.parseInt(inputReader.readLine());
          while(getTheSumOfDigits(n)%4!=0){
              n++;
          }
          System.out.println(n);
    }

}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws IOException
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int orig = Integer.parseInt(br.readLine());
        while(checkDivBy4(orig) % 4 != 0){
            orig++;
        }
        System.out.println(orig);
	    br.close();
	}
	public static int checkDivBy4(int n){
	    int sum = 0;
	    while(n > 0){
	        sum += n % 10;
	        n /= 10;
	    }
	    return sum;
	}
}

import java.util.*;

public class Main {
    public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      int x = input.nextInt();
      int i = 0;
      while (sum(x+i) != 0)
        i++;
      System.out.println(x+i);
    }

    public static int sum(int N) {
      int temp = N;
      int sum = 0;
      while (temp > 0) {
        sum += temp % 10;
        temp /= 10;
      }
      return sum % 4;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Admin
 */
public class A1183 {

    static BufferedReader br = new BufferedReader(new InputStreamReader(
            System.in));

    static long getInt() throws Exception {
        long n = Long.parseLong(br.readLine());
        return n;
    }

    static int[] getIntarr() throws Exception {
        String arr[] = br.readLine().split(" ");
        int a[] = new int[arr.length];
        for (int i = 0; i < a.length; i++) {
            a[i] = Integer.parseInt(arr[i]);
        }
        return a;
    }
    static int checkSum(int o){
        int sum=0;
        while(o>0){
           int r=o%10;
           sum+=r;
           o=o/10;
        }
        return sum;
    }

    public static void main(String[] args) throws Exception {
        String arr = br.readLine();
        int sum = 0;
        int n = Integer.parseInt(arr);
        while(true){
            int sumo=checkSum(n);
            if(sumo%4==0){
                System.out.println(n);
                break;
            }else{
                n++;
            }

        }
    }
}

import java.util.Scanner;

/**
 * Created by Taru on 13-Jul-19.
 */
public class sample {
    public static int computeSum(int n){
        int sum=0;
        while(n!=0){
            int r=n%10;
            sum+=r;
            n=n/10;
        }
        return sum;
    }
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);

        int a=scn.nextInt();
        int sum=0;

        int r;
        sum=computeSum(a);

            while(sum%4!=0){
                a+=1;
                sum=computeSum(a);
            }
            System.out.println(a);

    }
}

import java.io.*;
import java.util.*;

public class NearestInterestingNumber {

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		int a = Integer.parseInt(s);

		for(int i = 0; i <= 10; ++i) {
			int sum_test = integerSum(a);

			if(sum_test % 4 == 0)  {
				System.out.println(a);
				break;
			}

			else a++;
		}
	}

	public static int integerSum(int x) {
		String str = String.valueOf(x);
		int sum = 0;

		for(int i = 0; i < str.length(); ++i) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class june5_1
{

	public static void main (String[] args) throws java.lang.Exception
	{

		FastReader scan=new FastReader();

                int n=scan.nextInt();
                if(mysum(n)%4==0) System.out.println(n);
                else{
                int x=n;
                while(mysum(x)%4!=0){
                	x++;
                	//System.out.println(x+" "+d);
                }
                System.out.println(x);
                }
	}
	static int mysum(int x){
		int sum=0;
		while(x>0){
			sum+=x%10;
			x=x/10;
		}
		return sum;
	}
	static int myfun(int n){
		int temp=n;
        int sum=0;
		while(temp>0){
        	sum+=temp%10;
        	temp=temp/10;
        }
		return sum;
	}

		 static class FastReader{
	          BufferedReader in;
	          StringTokenizer st;
	          public FastReader(){
	              in=new BufferedReader(new InputStreamReader(System.in));
	          }
	          String next(){
	              while(st==null || !st.hasMoreElements()){
	                  try{
	                      st=new StringTokenizer(in.readLine());
	                  }
	                  catch(IOException e){
	                      e.printStackTrace();
	                  }
	               }
	               return st.nextToken();
	            }
	            int nextInt(){
	                return Integer.parseInt(next());
	            }
	            long nextLong(){
	                return Long.parseLong(next());
	            }
	            double nextDouble(){
	                return Double.parseDouble(next());
	            }
	            String nextLine(){
	            String str19 = "";
	            try{
	                str19 = in.readLine();
	            }
	            catch (IOException e){
	                e.printStackTrace();
	             }
	            return str19;
	        }
	      }
	}

import java.io.*;
import static java.lang.Math.*;
import java.util.*;
public class Moma {
 static FastReader in=new FastReader();
    public static void main(String[] args) {
     int a=in.nextInt(),n=a,ans=0,sum=0;
     while(a!=0){
         sum+=a%10;
         a/=10;

     ans++;

     }

        a=n;
        int an=sum%4;
        an=4-an;
       for(int i=0;i<=10;i++){
       a=n+i;sum=0;
            while(a!=0){
         sum+=a%10;
         a/=10;}
        if(sum%4==0){System.out.println(n+i);return;}
       }
}}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}

class Sorting{

 public static int[] bucketSort(int[] array, int bucketCount) {

 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");

 if (array.length <= 1) return array; //trivially sorted

 int high = array[0];

 int low = array[0];

 for (int i = 1; i < array.length; i++) { //find the range of input elements

 if (array[i] > high) high = array[i];

 if (array[i] < low) low = array[i];

 }

 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket

 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];

 for (int i = 0; i < bucketCount; i++) { //initialize buckets

 buckets[i] = new ArrayList();

 }

 for (int i = 0; i < array.length; i++) { //partition the input array

 buckets[(int)((array[i] - low)/interval)].add(array[i]);

 }

 int pointer = 0;

 for (int i = 0; i < buckets.length; i++) {

 Collections.sort(buckets[i]); //mergeSort

 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets

 array[pointer] = buckets[i].get(j);

 pointer++;

 }

}

return array;

}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Arrays;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alice
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Scanner str = new Scanner(System.in);
            int n = str.nextInt();
            int a = n/1000;
            int b = n/100 - a*10;
            int c = n/10 - b*10 - a*100;
            int d = n - c*10 - b*100 - a*1000;
            for(int i = 0; i < 20; i++) {
                if((a+b+c+d)%4 != 0) {
                    n++;
                    a = n/1000;
                    b = n/100 - a*10;
                    c = n/10 - b*10 - a*100;
                    d = n - c*10 - b*100 - a*1000;
                }else {
                    break;
                }
            }

            if(a == 0) {
                if(b == 0) {
                    if(c == 0) {
                        System.out.println(d);
                    }else {
                        System.out.println(c+""+d);
                    }
                }else {
                    System.out.println(b+""+c+""+d);
                }
            }else {
                System.out.println(a+""+b+""+c+""+d);
            }
        }
    }
}

import java.io.*;
import java.util.Arrays;

public class Main {

	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ne=br.readLine();
		int n=Integer.parseInt(ne);
		int l=n;
		int sum=0;
		int flag=0;
		while(flag==0) {

		while(n>0) {
			int c=n%10;
			sum+=c;
			n=n/10;
		}
		if(sum%4==0) {
			flag=1;
		}
		else {
			l=l+1;
			sum=0;
			n=l;
		}
		}
		System.out.println(l);

	}
}

import java.util.*;
import java.io.*;

public class Main {

    private static boolean isInteresting(int n) {
        int total = 0;
        while (n > 0) {
            total += n%10;
            n /= 10;
        }
        if (total % 4 == 0) {
            return true;
        }
        return false;
    }
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = n; ; i++) {
            if (isInteresting(i)) {
                System.out.println(i);
                break;
            }
        }

    }
}

import java.util.*;
import java.io.*;public class Main
{
	public static int sumD(int x){
		int j=0;
		while(x!=0){
			j+=(x%10);
			x/=10;
		}
		return j;
	}
	public static void main(String[] args)
	{
		  Scanner sc=new Scanner(new InputStreamReader(System.in));
		  int n=sc.nextInt();
		  if(sumD(n)%4==0){System.out.println(n);}
		  else{
		  while(sumD(++n)%4!=0);
		  System.out.println(n);
		  }
	}
}

import java.util.*;

import java.io.*;
public class A {
	public static void main(String args[]) {
		FastScanner in=new FastScanner();
		int n=in.nextInt();
		int val;
		for(int i=n;i<=1003;i++) {
			int sumD=0;
			int num=i;
			while(num>0) {
				sumD=sumD+num%10;
				num=num/10;
			}
			if(sumD%4==0) {
				System.out.println(i);
				break;
			}
		}
	}

	///////////////////////////
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

import java.util.*;
public class A {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int sum=0;
		int input = in.nextInt();

		while(true) {
			if(convert(input)%4==0) break;
			input++;
		}
		System.out.println(input);
	}
	static int convert(int n) {
		int sum=0;
		while(n>0) {
			sum+=n%10;
			n/=10;
		}
		return sum;
	}
}

import java.util.Scanner;

public class Nin {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        int sum =(input/1000)+(input/100-input/1000*10)+(input/10-input/100*10)+(input-input/10*10);
        while (sum % 4 != 0){
            input++;
            sum =(input/1000)+(input/100-input/1000*10)+(input/10-input/100*10)+(input-input/10*10);
        }
        System.out.print(input);
    }
}

import java.util.Scanner;

public class NearestInterestingNumber {
    public static void main(String[] args) {

        Scanner sisf = new Scanner(System.in);

        int a = sisf.nextInt();

        while (sumofints(a) % 4 != 0) {
            a++;
        }

        System.out.println(a);

    }

    public static int sumofints(int n) {

        String[] ints = String.valueOf(n).split("");

        int totalsum = 0;
        for (String x : ints) {
            totalsum += Integer.parseInt(x);
        }

        return totalsum;

    }
}

import java.util.Scanner;

public class ContestProblem {

    boolean check(int a){
        int digit=0;
        while(a!=0){
            digit=digit+(a%10);
            a=a/10;
        }
        if(digit%4==0)return true;
        return false;
    }

    public static void main(String[] args) {
        int a;
        ContestProblem ob=new ContestProblem();
        Scanner inp=new Scanner(System.in);
        a=inp.nextInt();
        while(true){
            if(ob.check(a)){
                System.out.println(a);
                break;
            }
            else {
                a++;
            }
        }
    }

}

import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Main implements Runnable
{
  static class InputReader
  {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;
    private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

    public InputReader(InputStream stream)
    {
      this.stream = stream;
    }

    public int read()
    {
      if (numChars==-1)
        throw new InputMismatchException();

      if (curChar >= numChars)
      {
        curChar = 0;
        try
        {
          numChars = stream.read(buf);
        }
        catch (IOException e)
        {
          throw new InputMismatchException();
        }

        if(numChars <= 0)
          return -1;
      }
      return buf[curChar++];
    }

    public String nextLine()
    {
      String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
    }
    public int nextInt()
    {
      int c = read();

      while(isSpaceChar(c))
        c = read();

      int sgn = 1;

      if (c == '-')
      {
        sgn = -1;
        c = read();
      }

      int res = 0;
      do
      {
        if(c<'0'||c>'9')
          throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = read();
      }
      while (!isSpaceChar(c));

      return res * sgn;
    }

    public long nextLong()
    {
      int c = read();
      while (isSpaceChar(c))
        c = read();
      int sgn = 1;
      if (c == '-')
      {
        sgn = -1;
        c = read();
      }
      long res = 0;

      do
      {
        if (c < '0' || c > '9')
          throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = read();
      }
      while (!isSpaceChar(c));
        return res * sgn;
    }

    public double nextDouble()
    {
      int c = read();
      while (isSpaceChar(c))
        c = read();
      int sgn = 1;
      if (c == '-')
      {
        sgn = -1;
        c = read();
      }
      double res = 0;
      while (!isSpaceChar(c) && c != '.')
      {
        if (c == 'e' || c == 'E')
          return res * Math.pow(10, nextInt());
        if (c < '0' || c > '9')
          throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = read();
      }
      if (c == '.')
      {
        c = read();
        double m = 1;
        while (!isSpaceChar(c))
        {
          if (c == 'e' || c == 'E')
            return res * Math.pow(10, nextInt());
          if (c < '0' || c > '9')
            throw new InputMismatchException();
          m /= 10;
          res += (c - '0') * m;
          c = read();
        }
      }
      return res * sgn;
    }

    public String readString()
    {
      int c = read();
      while (isSpaceChar(c))
        c = read();
      StringBuilder res = new StringBuilder();
      do
      {
        res.appendCodePoint(c);
        c = read();
      }
      while (!isSpaceChar(c));

      return res.toString();
    }

    public boolean isSpaceChar(int c)
    {
      if (filter != null)
        return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next()
    {
      return readString();
    }

    public interface SpaceCharFilter
    {
      public boolean isSpaceChar(int ch);
    }
  }

  public static void main(String args[]) throws Exception
    	{
    		new Thread(null, new Main(),"Main",1<<26).start();
    	}
    //User-defined functions goes here...

    class Vertex{
      List<Link> links;
    }
    class Link{
      int node;
      int time;
      Link(int n, int t)
      {
        node=n;
        time=t;
      }
    };

    class State{
      int node;
      int time;
      int fishes;
      State(int node, int time, int fishes){
        this.node=node;
        this.time=time;
        this.fishes=fishes;
      }
    }

  public void run()
  {
    InputReader sc= new InputReader(System.in);
    PrintWriter w= new PrintWriter(System.out);

      //Your code goes here...
      int n=sc.nextInt();
      int sum=0;
      int nn=n;

        for(int i=n; i<=1100; i++){
          sum=0;
          nn=i;
          while(i>0){
            sum+=i%10;
            i/=10;
          }
          if(sum%4==0){
            System.out.println(nn);
            break;
          }
          i=nn;
        }

  w.close();

}
}

import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        for(int i=a;i<=a+10;i++){
            if(sumofChars(i)%4==0){
                System.out.println(i);
                return;
            }
        }
    }

    private static int sumofChars(int a) {
        String b = String.valueOf(a);
        int sum = 0;
        for(int i=0;i<b.length();i++){
            sum += b.charAt(i) - '0';
        }
        return sum;
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static Scanner scanner = new Scanner(System.in);
    public static boolean inte(int n ) {
        int sum = 0;
        while (n > 0) {
            sum+=n%10;
            n/=10;
        }
        if (sum%4 == 0) return true;
        return false;
    }
    public static void main(String[] args) {

        int n = scanner.nextInt();
        boolean b =true;
        while (true){
            if (inte(n)) {
                System.out.println(n);
                break;
            }
            n++;
        }
    }

}

import java.util.Scanner;

public class CodeForces {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int number;
        while (sc.hasNext()) {
            number = sc.nextInt();
            boolean band = false;
            do {
                String aux = String.valueOf(number);
                int aux2 = 0;
                for (int i = 0; i < aux.length(); i++) {
                    aux2 += Integer.valueOf(aux.charAt(i));
                }
                if (aux2 % 4 == 0) {
                    band = true;
                }else{
                    number++;
                }
            } while (band == false);
            System.out.println(number);
        }
    }

}

import java.util.*;
public class NearestInterestingNumber {

   static int sum(int n){
       int x =0;
           while(n>0){
               x+=n%10;
               n/=10;
           }
           return x;
   }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while(sum(n)%4!=0){
            n++;
        }
        System.out.println(n);

        }
        }

import java.io.*;
import java.util.StringTokenizer;

public class A1 {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 0;
            int arr[] = new int[1010];
            setSums(arr);
            for (int i = n; i < arr.length; i++) {
                if (arr[i] % 4 == 0) {
                    out.println(i);
                    break;
                }
            }
        }

        private void setSums(int[] arr) {
            for (int i = 1; i < arr.length; i++) {
                arr[i] = getSum(i);
            }
        }

        private int getSum(int n) {
            int ans = 0;
            while (n != 0) {
                ans += n % 10;
                n /= 10;
            }
            return ans;
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public Long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.util.Scanner;

public class polycrap {

    static int sumOf(int n) {
        int i = 0, sum = 0;
        for (i = n; i > 0; i = i / 10) {
            int a = i % 10;
            sum = sum + a;
        }

        return sum;
    }

    public static void main(String args[]) {
        Scanner ob = new Scanner(System.in);
        int n = ob.nextInt();
        int j = 0, m = 0;
        int newSum = 0;
        boolean r = true;
        while (r == true) {
            m = n + j;
            newSum = sumOf(m);
            if (newSum % 4 == 0) {
                r = false;
            }
            j++;
        }
        System.out.print(m);
    }
}

import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		StringTokenizer st = new StringTokenizer(br.readLine());
//		int x = Integer.parseInt(st.nextToken());
//		int y = Integer.parseInt(st.nextToken());
//		int z = Integer.parseInt(st.nextToken());
//		int N = Integer.parseInt(br.readLine());

//		int a = Integer.parseInt(br.readLine());
		String a = br.readLine();

		int A = Integer.parseInt(a);

		for (int n = A; n <= 2000; n++) {
			a = n + "";
			int sum = 0;
			for (int i = 0; i < a.length(); i++) {
				sum += a.charAt(i) - '0';
			}
//			System.out.println(sum);
			if (sum % 4 ==0) {
				System.out.println(n);
				break;
			}
		}
//		for (int t = 0; t < T; t++) {
//			int N = Integer.parseInt(br.readLine());
//			String s = br.readLine();
//		}
	}
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,j,m=0,k,p=0,h,l,x,y,d;
		String s,st;
		for(i=0;i<t;i++)
		{
		    m=0;
		    n=in.nextInt();
		    d=n;
		    while(n>0)
		    {
		         x=n%10;
		         m+=x;
		         n=n/10;
		    }
		    if(m%4==0)
		    System.out.println(d);
		    else
		    {
		        for(j=n+1;;j++)
		        {
		            m=0;d=j;
		            while(d>0)
		            {
		                x=d%10;
		                m=m+x;
		                d=d/10;
		            }
		            if(m%4==0)
		            {
		            System.out.println(j);
		            break;
		            }
		        }
		    }
		}
	}
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws IOException
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int orig = Integer.parseInt(br.readLine());
		if(checkDivBy3(orig)){
		    if(checkDivBy4(orig))
		        System.out.println(orig);
		    else {
		        for(int i=orig+1;i<=1000;i++){
		            if(checkDivBy4(i)){
		                System.out.println(i);
		                break;
		            }
		        }
		    }
		}
	}
	public static boolean checkDivBy3(int n){
	    int sum = 0;
	    while(n > 0){
	        int rem = n % 10;
	        sum += rem;
	        n /= 10;
	    }
	    if(sum % 3 == 0)
	        return true;
	    return false;
	}
	public static boolean checkDivBy4(int n){
	    int sum = 0;
	    while(n > 0){
	        int rem = n % 10;
	        sum += rem;
	        n /= 10;
	    }
	    if(sum % 4 == 0)
	        return true;
	    return false;
	}
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t=1,n,i,j,m=0,k,p=0,h,l,x,y,d;
		String s,st;
		for(i=0;i<t;i++)
		{
		    m=0;
		    n=in.nextInt();
		    while(n>0)
		    {
		         x=n%10;
		         m+=x;
		         n=n/10;
		    }
		    y=m%4;
		    switch(y)
		    {
		         case 0: break;
		         case 1: n+=3;
		         case 2: n+=2;
		         case 3: n+=1;
		    }
		    System.out.println(n);
		}
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;

public class GFG {
	public static void main (String[] args) {
	PrintWriter pw=new PrintWriter(System.out);
	Scanner sc=new Scanner(System.in);
	String s=sc.next();
	int sum=0;
	for(int i=0;i<s.length();i++)
    sum+=(int)s.charAt(i)-48;
    int m=4-(sum%4);
	int r=Integer.parseInt(s)+m;
	pw.print(r);

	pw.close();
	}
}

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        int a = console.nextInt(), temp = a, sum = 0;
        while (temp > 0) {
          sum += temp % 10;
          temp /= 10;
        }
        while (sum % 4 != 0) {
          sum = 0;
          temp = a;
          while (temp > 0) {
            sum += temp % 10;
            temp /= 10;
          }
          a++;
        }
        System.out.println(a-1);
    }
}

import java.io.*;
import java.util.*;
public class NearestInterestingNumber
{
    public static void main(String[] f)
    {
        int T,N,M,sumdigi=0;
        Scanner sc=new Scanner(System.in);
        N=sc.nextInt();
        M=N;
        for(int j=0;j<=4;j++)
        {
         sumdigi=0;
        while(M!=0)
        {
            sumdigi+=(M%10);
            M/=10;
        }
        if(sumdigi%4==0)
        {
        System.out.println(N+j);
        break;
        }
        M=(N+j+1);
        }
    }
}

import java.io.*;
import java.util.*;

public class test {
	/*
	 * array list
	 *
	 * ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers
	 *
	 * BigInteger a=new BigInteger(); BigInteger b=new BigInteger();
	 *
	 * hash map
	 *
	 * HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>(); for(int
	 * i=0;i<ar.length;i++) { Integer c=hm.get(ar[i]); if(hm.get(ar[i])==null) {
	 * hm.put(ar[i],1); } else { hm.put(ar[i],++c); } }
	 *
	 * while loop
	 *
	 * int t=sc.nextInt(); while(t>0) { t--; }
	 *
	 * array input
	 *
	 * int n = sc.nextInt(); int ar[] = new int[n]; for (int i = 0; i < ar.length;
	 * i++) { ar[i] = sc.nextInt(); }
	 */
	// private static final Scanner sc = new Scanner(System.in);
	// static Scanner sc = new Scanner(new BufferedReader(new
	// InputStreamReader(System.in)));

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	private static final Scanner sc = new Scanner(System.in);
	private static final FastReader fs = new FastReader();

	public static void main(String[] args) {
		String z=fs.next();
		StringBuilder ss=new StringBuilder(z);
		String ffString=ss.reverse().toString();
		z=z+ffString;
		System.out.println(z);}

}/* till here */

//package CodeForces;

import java.util.Scanner;

public class NearestInterstingProb {

	static int getSum(int x)
	{
		int temp=0;
		while(x>0)
		{
			temp=temp+x%10;
			x=x/10;
		}
		return temp;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int temp=getSum(n);
		while(temp%4!=0)
		{
			n=n+temp%4;
			temp=getSum(n);
		}
		System.out.println(n);

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Arrays;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alice
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Scanner str = new Scanner(System.in);
            int n = str.nextInt();
            if(n == 1000) {
                System.out.println(1004);
            }else {
                int a = n/100;
                int b = n/10 - a*10;
                int c = n - b*10 - a*100;
                for(int i = 0; i < 4; i++) {
                    if((a+b+c)%4 != 0) {
                        n++;
                        a = n/100;
                        b = n/10 - a*10;
                        c = n - b*10 - a*100;
                    }else {
                        break;
                    }
                }
                if(a == 0) {
                    if(b == 0) {
                        System.out.println(c);
                    }else {
                        System.out.println(b+""+c);
                    }
                }else {
                    System.out.println(a+""+b+""+c);
                }
            }
        }
    }
}

import java.util.*;
public class Ninu1
{
	public static int sumDigit(int a)
	{
		String s = String.valueOf(a);
		char[] cs = s.toCharArray();
		int[] x = new int[s.length()];
		for(int i=0;i<s.length();i++)
		{
			x[i] = Character.getNumericValue(cs[i]);
		}
		int sum = Arrays.stream(x).sum();
		return sum;
	}
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sumDigit(n);
		if(sum%4==0)
		{
			System.out.println(n);
		}
		else
		{
			int rem = sumDigit(sumDigit(n))%4;
			rem = 4-rem;
			n += rem;
			if(sumDigit(n)%4==0)
			{
				System.out.println(n);
			}
			else
			{
				rem = sumDigit(n)%4;
				rem = 4-rem;
				n+= rem;
				System.out.println(n);

			}
		}
	}
}

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        if (input == 1000) {
            System.out.println(1003);
            return;
        }
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input / 100;
        return (a+b+c)%4 == 0;
    }
}

import java.util.Scanner;
/**
 *
 * @author USER
 */
public class Problem800A {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Scanner sc=new Scanner(System.in);

        int i=sc.nextInt();

        if(i%3==0){
        int result=check(i);
        //System.out.println(result);
        if(result%4==0){
        System.out.println(i);
        }

        else{
        for(int k=i;result%4!=0;k++){
        result=check(k);
        //System.out.println(result);
        if(result%4==0){
        System.out.println(k);
        }
        }
        }
    }
    }
     public static int check(int z){
     int sum=0;
     while(z>0){
        int n=z%10;
        sum+=n;
        z=z/10;
        }
     return sum;
     }
    }

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        if (input == 1000) {
            System.out.println(1003);
        }
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input / 100;
        return (a+b+c)%4 == 0;
    }
}

import java.util.*;

public class nearestInterestingNumber {

static int counter(int val){
    while(val%4!=0){
        val++;
    }
    return val;
}
static int getSum(int val){
    int sum=0;

    while(val>0){
        sum+=val%10;
        val=val/10;
    }
    return sum;
}

static int getInterestingNumber(int a){
    int val=a;
    int sum=getSum(val);
    if(sum%4==0){
        return val;
    }
    String s="";
    int length;
    s=Integer.toString(val);
    length=s.length();
    int rem=counter(sum)-sum;
    int grandSum=val+rem;
    String l=Integer.toString(grandSum);
    int len=l.length();
    if((len)>=(length+1)){
        return (int)Math.pow(10,length)+3;
    }
    else{
        return (val+rem);
        }
}

public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int ans=getInterestingNumber(a);
System.out.println(ans);

}

}

import java.util.Scanner;

public class test {
	public static int pows(int n) {
		int result = 1;
		for(int i = 0; i < n ; i++) result *= 10;
		return result;
	}
	public static int getN(int n, int s) {
		return (n%pows(s)) / pows(s-1);
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.close();
		while(true) {
			int sum = 0;
			for(int i = 1; i < 4; i++) sum += getN(n, i);
			if(sum % 4 == 0) {
				System.out.println(n);
				return;
			}
			n++;
		}
	}

}

import java.util.Scanner;
public class CodeForces {
	public static void main (String [] args)
	{
		Scanner input = new Scanner( System.in );
		int m = input.nextInt();
		int k = m;
		int rightmost = 0;
		int sum = 0;
		while (k > 0)
		{
			rightmost = k % 10;
			sum += rightmost;
			k = k/10;
		}
		if (sum % 4 == 0)
		{
			System.out.println(m);
		}
		else if ((sum + 1) % 4 == 0)
		{
			System.out.println(m+1);
		}
		else if ((sum + 2) % 4 == 0)
		{
			System.out.println(m+2);
		}
		else if ((sum + 3) % 4 == 0)
		{
			System.out.println(m+3);
		}

	}
}

import java.io.*;
import java.util.StringTokenizer;
import java.util.*;
import java.math.*;
public class Solution{

    public static void main(String[] args) throws Exception {
        FastScanner cin = new FastScanner(System.in);
        int n = cin.nextInt();
        for(int i=n;i<=n+4;i++)
        {
          int temp = i;
          int sum = 0;
          while(temp!=0)
          {
            int r = temp%10;
            sum+=r;
            temp = temp/10;

          }
          if(sum%4==0)
          {
            System.out.println(i);
            break;
          }
        }
       }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
  }

import java.util.*;
public class prog{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int iNum, distance;

        iNum = scan.nextInt();
        distance=4-(iNum/100+(iNum/10)%10+iNum%10)%4;

        if(distance!=4){
            test: if(distance+iNum%10>=10){
                if((iNum/10)%10==9){
                    if(iNum/100==9){
                        distance+=3;
                        break test;
                    }
                    distance+=distance-(10-iNum%10)<2 ? 2 : -2;
                    break test;
                }
                distance+=1;
            }
            System.out.println(distance+iNum);
        }else{
            System.out.println(iNum);
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.lang.management.MemoryType;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static final int INF = Integer.MAX_VALUE;

    static int mergeSort(long[] a,long [] c, int begin, int end)
    {
        int inversion=0;
        if(begin < end)
        {
            inversion=0;
            int mid = (begin + end) >>1;
            inversion+= mergeSort(a,c, begin, mid);
            inversion+=mergeSort(a, c,mid + 1, end);
            inversion+=merge(a,c, begin, mid, end);
        }
        return inversion;
    }

    static int  merge(long[] a,long[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        long[] L = new long[n1+1], R = new long[n2+1];
        long[] L1 = new long[n1+1], R1 = new long[n2+1];

        //inversion
        int inversion=0;

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
          //  L2[i] = w[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
            //R2[i] = w[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i];
                ++i;
              //  w[k]=L2[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j];
               //w[k] = R2[j++];
                ++j;

                inversion=inversion+(n1-i);

            }
        return inversion;

    }

    static int []c;
    static int[] v;
    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    public static void main (String[]args) throws IOException {
        Scanner in = new Scanner(System.in);
        try(PrintWriter or = new PrintWriter(System.out)){
       int n=in.nextInt();
       int ans=0;
            for (int i = n; ; i++) {
                ans=0;
                int y=i;
                while (i>1){
                    ans+=(i%10);
                    i/=10;
                }
                if (ans%4==0){
                    or.println(y);
                    break;
                }
            }

        }

    }
    static int getlen(int r,int l,int a){
        return (r-l+1+1)/(a+1);
    }
    static int check(Pair[] a, int c) {
        ArrayList<Integer> trouble = new ArrayList<>();
        int n = a.length;
        for (int i = 0; i < n - 1; i++)
            if (a[i + 1].val - a[i].val != c) trouble.add(i);
        if (trouble.size() == 0) return a[0].idx + 1;
        if (trouble.size() == 1) {
            int idx = trouble.get(0);
            if (idx == 0) return a[idx].idx + 1;
            if (idx == n - 2) return a[idx + 1].idx + 1;
            if (a[idx].val == a[idx + 1].val) return a[idx].idx + 1;
        }
        if (trouble.size() == 2) {
            int one = trouble.get(0);
            int two = trouble.get(1);
            if (one + 1 == two && a[two + 1].val - a[one].val == c) return a[two].idx + 1;
        }
        return -1;
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

 class Pair implements Comparable<Pair> {
    int idx, val;

    public Pair(int idx, int val) {
        this.idx = idx;
        this.val = val;
    }

    @Override
    public int compareTo(Pair o) {
        return val - o.val;
    }

}

class prog implements Comparable<prog> {

    int l;
    int r;
    int a;

    public prog(int l, int r) {
        this.l = l;
        this.r = r;

    }

    @Override
    public int compareTo(prog o) {
        if (l!=o.l)return (o.l-l);
        return r-o.r;
    }
}

import java.io.*;
import java.util.*;
public class NearestInterestingNumber
{
    public static void main(String[] f)
    {
        int T,N,M,sumdigi=0;
        Scanner sc=new Scanner(System.in);
        N=sc.nextInt();
        M=N;
        while(sumdigi/10!=0)
        {
        while(M!=0)
        {
            sumdigi+=(M%10);
            M/=10;
        }
        M=sumdigi;
        }
        N+=(4-sumdigi);
        System.out.println(N);
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws IOException
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int orig = Integer.parseInt(br.readLine());
	    if(checkDivBy4(orig))
	        System.out.println(orig);
	    else {
	        for(int i=orig+1;i<=1000;i++){
	            if(checkDivBy4(i)){
	                System.out.println(i);
	                break;
	            }
	        }
	    }
	}
	public static boolean checkDivBy4(int n){
	    int sum = 0;
	    while(n > 0){
	        int rem = n % 10;
	        sum += rem;
	        n /= 10;
	    }
	    if(sum % 4 == 0)
	        return true;
	    return false;
	}
}

import java.util.*;
import java.io.*;

/**
 * @author kenpen
 */
public class NearestInterestingNumber
{
    public static void main(String...args)
    {
        int a = getInt();
        int ans = a;
        for (int i = 0 ; i < 4; ++i) {
            int sum = sum(a + i);
            if (sum % 4 == 0) {
                ans = a + i;
                break;
            }
        }

//        if (sum % 4 != 0) ans = a + ( 4 - sum % 4);
        System.out.println(ans);
    }

    static int sum(int a) {
        int sum = 0;
        while (a != 0) {
            sum += a % 10;
            a = a / 10;
        }
        return sum;
    }

    // ===== Printing code =====
    static StringBuilder buf = new StringBuilder();
    static int bufSize = 5000;
    static void print(String s) {print(s, false);}

    static void print(String s, boolean newLine) {
        buf.append(s);
        if (newLine) buf.append("\n");
        if (buf.length() >= bufSize) {
            System.out.print(buf);
            buf.delete(0, buf.length());
        }
    }

    static void flush() {
        System.out.print(buf);
        buf.delete(0, buf.length());
    }

    static String arrayToString(int[] arr) {
        StringBuilder sb = new StringBuilder();
        for (int a : arr) sb.append(a).append(" ");
        if (arr.length > 0) sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }

    // ===== INPUT TAKING CODE ====
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static void checkSt() {
        if (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                System.out.println("Error parsing input");
            }
        }
    }
    static int getInt() {
        checkSt();
        return Integer.valueOf(st.nextToken());
    }

    static long getLong() {
        checkSt();
        return Long.valueOf(st.nextToken());
    }

    static long getNewLineLong() {
        try {
            return Long.valueOf(br.readLine());
        } catch (IOException e) {
            System.out.println("Error parsing input");
            return 0;
        }
    }

    static int getNewLineInt() {
        try {
            return Integer.valueOf(br.readLine());
        } catch (IOException e) {
            System.out.println("Error parsing input");
            return 0;
        }
    }

    static char getChar() {
        checkSt();
        return st.nextToken().charAt(0);
    }

    static String getStr() {
        checkSt();
        return st.nextToken();
    }

}

import java.util.ArrayList;
import java.util.Scanner;

public class ATD {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int nn = n;
        ArrayList<Integer> arr = new ArrayList<Integer>();
        int counter = 0;
        while (n >= 1){
            arr.add(n%10);
            counter+=n%10;
            n/=10;
        }
        if (counter%4 == 0){
            System.out.println(nn);
            return;
        }
        arr.add(0);
        while (counter%4!=0){
            if (arr.get(0) == 9){
                for (int i = 1; i < arr.size(); i++) {
                    arr.remove(0);
                    arr.add(0, 0);
                    counter -= 8;
                    if (arr.get(i) == 9) {
                        counter -= 9;
                        arr.remove(i);
                        arr.add(i, 0);
                    }
                    else {
                        arr.add(i, arr.get(i)+1);
                        arr.remove(i+1);
                        break;
                    }
                }
            }
            counter++;
            arr.add(0,arr.get(0)+1);
            arr.remove(1);
        }
        for (int i = arr.size()-2; i >= 0; i--) {
            System.out.print(arr.get(i));
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Arrays;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alice
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Scanner str = new Scanner(System.in);
            int n = str.nextInt();
            if(n == 1000) {
                System.out.println(1003);
            }else {
                int a = n/100;
                int b = n/10 - a*10;
                int c = n - b*10 - a*100;
                for(int i = 0; i < 4; i++) {
                    if((a+b+c)%4 != 0) {
                        n++;
                        a = n/100;
                        b = n/10 - a*10;
                        c = n - b*10 - a*100;
                    }else {
                        break;
                    }
                }
                if(a == 0) {
                    if(b == 0) {
                        System.out.println(c);
                    }else {
                        System.out.println(b+""+c);
                    }
                }else {
                    System.out.println(a+""+b+""+c);
                }
            }
        }
    }
}

import java.util.*;
public class NearestInterestingNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int temp = n;
        int i = 0;
        int sum = 0;
        int a[] = new int[4];
        while(n>0){
            a[i] = n%10;
            n/=10;
            i++;
        }
        for(int j = 0;j<4;j++){
           sum+=a[j];
        }
        int m = sum%4;
        if(m==0){

            System.out.println(temp);
        }
        else if((a[0]==9)||(a[0]==8)){
              System.out.println(temp+(6-m));
        }
        else{

            System.out.println(temp+(4-m));
        }
        }
        }

/*
    by Fuzious
    21/6/2019
*/

import java.io.*;
import java.util.*;

public class codeforces {
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        int  TC=sc.nextInt();
//        for (int tc = 0; tc < TC; tc++) {
//
//        }
        if(sum(""+TC)%4==0){
            out.println(TC);
        }
        else if(sum(""+(TC+1))%4==0){
            out.println(TC+1);
        }
        else if(sum(""+(TC+2))%4==0){
            out.println(TC+2);
        }
        else if(sum(""+TC+3)%4==0) {
            out.println(TC+3);
        }
        else {
            out.println(TC+4);
        }
        out.close();
    }
    static int sum(String a) {
        int sm=0;
        for (int i = 0; i < a.length(); i++) {
            sm+=a.charAt(i)-48;
        }
        return sm;
    }
    static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    static int mod = 1000000000 + 7;

    static class InputReader  {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public double nextDouble() {
            return (Double.parseDouble(readString()));
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	int a=scan.nextInt();
	int digsum=0;

	for(int k=a;k>0;k/=10){
	    digsum+=k%10;
	}
	int n=(digsum%4==0)?a:a+(4-digsum%4);
	System.out.println(n);
    }
}

import java.util.*;
import java.io.*;

public class Main {
	static long mod = 1000000007;
	static int INF = 1000000000;
 	public static void main(String[] args){
		FastScanner scanner = new FastScanner();
		int a = scanner.nextInt();
		int[] b = new int[5];
		b[0] = a;
		b[1] = a+1;
		b[2] = a+2;
		b[3] = a+3;
		b[4] = a+4;
		int[] c = new int[5];
		for(int i = 0; i< 5; i++){
			c[i] = b[i];
		}
		int[] sum = new int[5];
		for(int i = 0; i < 5; i++){
			while(b[i] > 0){
				sum[i] += b[i]%10;
				b[i] /= 10;
			}
		}

		for(int i = 0; i < 5; i++){
			if(sum[i]%4==0){
				System.out.println(c[i]);
				return;
			}
		}
	}
	static class Pair implements Comparable<Pair>{
    int first, second;
    Pair(int a, int b){
        first = a;
        second = b;
    }
    @Override
    public boolean equals(Object o){
        if (this == o) return true;
        if (!(o instanceof Pair)) return false;
        Pair p = (Pair) o;
        return first == p.first && second == p.second;
    }
    @Override
    public int compareTo(Pair p){
        //return first == p.first ? second - p.second : first - p.first; //firstで昇順にソート
        //return (first == p.first ? second - p.second : first - p.first) * -1; //firstで降順にソート
        //return second == p.second ? first - p.first : second - p.second;//secondで昇順にソート
        //return (second == p.second ? first - p.first : second - p.second)*-1;//secondで降順にソート
		    //return first * 1.0 / second > p.first * 1.0 / p.second ? 1 : -1; // first/secondの昇順にソート
		    //return first * 1.0 / second < p.first * 1.0 / p.second ? 1 : -1; // first/secondの降順にソート
				//return second * 1.0 / first > p.second * 1.0 / p.first ? 1 : -1; // second/firstの昇順にソート
		    //return second * 1.0 / first < p.second * 1.0 / p.first ? 1 : -1; // second/firstの降順にソート
				//return Math.atan2(second, first) > Math.atan2(p.second, p.first) ? 1 : -1; // second/firstの昇順にソート
				//return first + second > p.first + p.second ? 1 : -1; //first+secondの昇順にソート
				//return first + second < p.first + p.second ? 1 : -1; //first+secondの降順にソート
				return first - second < p.first - p.second ? 1 : -1; //first-secondの降順にソート
		}
  }

	private static class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
				if (ptr < buflen) {
						return true;
				}else{
						ptr = 0;
						try {
								buflen = in.read(buffer);
						} catch (IOException e) {
								e.printStackTrace();
						}
						if (buflen <= 0) {
								return false;
						}
				}
				return true;
		}
		private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
		private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
		public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
		public String next() {
				if (!hasNext()) throw new NoSuchElementException();
				StringBuilder sb = new StringBuilder();
				int b = readByte();
				while(isPrintableChar(b)) {
						sb.appendCodePoint(b);
						b = readByte();
				}
				return sb.toString();
		}
		public long nextLong() {
				if (!hasNext()) throw new NoSuchElementException();
				long n = 0;
				boolean minus = false;
				int b = readByte();
				if (b == '-') {
						minus = true;
						b = readByte();
				}
				if (b < '0' || '9' < b) {
						throw new NumberFormatException();
				}
				while(true){
						if ('0' <= b && b <= '9') {
								n *= 10;
								n += b - '0';
						}else if(b == -1 || !isPrintableChar(b)){
								return minus ? -n : n;
						}else{
								throw new NumberFormatException();
						}
						b = readByte();
				}
		}
		public int nextInt() {
				long nl = nextLong();
				if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
				return (int) nl;
		}
		public double nextDouble() { return Double.parseDouble(next());}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.*;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {

	static int k;

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {

        public void solve(int testNumber, InputReader in, PrintWriter out) {

        		int n=in.nextInt();
        		for(int i=0;i<4;i++) {
        			if((n+i)%4==0) {
        				System.out.println(n+i);
        				return;
        			}
        		}

        }

    }

    static class InputReader
    {
        BufferedReader br;
        StringTokenizer st;

        public InputReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

    }
    public static void sort(int[] a, int low, int high)
    {
        int N = high - low;
        if (N <= 1)
            return;
        int mid = low + N/2;
        // recursively sort
        sort(a, low, mid);
        sort(a, mid, high);
        // merge two sorted subarrays
        int[] temp = new int[N];
        int i = low, j = mid;

        for (int k = 0; k < N; k++)
        {
            if (i == mid)
                temp[k] = a[j++];
            else if (j == high)
                temp[k] = a[i++];
            else if (a[j]<a[i])
                temp[k] = a[j++];
            else
                temp[k] = a[i++];
        }
        for (int k = 0; k < N; k++)
            a[low + k] = temp[k];
    }
}

import java.util.*;
public class Q1
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		if(getsum(n)%4==0)
		{
			System.out.println(n);
		}
		else if(getsum(n+1)%4==0)
		{
			System.out.println(n+1);
		}
		else if(getsum(n+2)%4==0)
		{
			System.out.println(n+2);
		}
		else if(getsum(n+3)%4==0)
		{
			System.out.println(n+3);
		}
		else if(getsum(n+4)%4==0)
		{
			System.out.println(n+4);
		}
		else if(getsum(n+5)%4==0)
		{
			System.out.println(n+5);
		}
	}
	public static int getsum(int num)
	{
		int sum=0;
		while(num!=0)
		{
			sum = sum + num%10;
			num = num/10;
		}
		return sum;
	}
}

import java.util.Scanner;

public class NearestInterestingNumber {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int num = in.nextInt();
		int n = num;
		int sum = 0;

		for (int i = 100; i > 0; i /= 10) {
			sum += n / i;
			n -= (n / i) * i;
		}

		System.out.println(sum % 4 == 0 ? num : num + 4 - (sum % 4));
	}
}

/*
    by Fuzious
    21/6/2019
*/

import java.io.*;
import java.util.*;

public class codeforces {
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        int  TC=sc.nextInt();
//        for (int tc = 0; tc < TC; tc++) {
//
//        }
        if(sum(""+TC)%4==0){
            out.println(TC);
        }
        else if(sum(""+(TC+1))%4==0){
            out.println(TC+1);
        }
        else if(sum(""+(TC+2))%4==0){
            out.println(TC+2);
        }
        else if(sum(""+(TC+3))%4==0) {
            out.println(TC+3);
        }
        else if(sum(""+(TC+4))%4==0) {
            out.println(TC+4);
        }
        else if(sum(""+(TC+5))%4==0) {
            out.println(TC+5);
        }else if((sum(""+(TC+6)))%4==0) {
//            System.out.println(sum(""+(TC+6))%4==0);
            out.println(TC+6+" hi");
        }else if(sum(""+(TC+7))%4==0) {
            out.println(TC+7);
        }else if(sum(""+(TC+8))%4==0) {
            out.println(TC+8);
        }else if(sum(""+(TC+9))%4==0) {
            out.println(TC+9);
        }
        else if(sum(""+(TC+10))%4==0) {
            out.println(TC+10);
        }else if(sum(""+(TC+11))%4==0) {
            out.println(TC+11);
        }else if(sum(""+(TC+12))%4==0) {
            out.println(TC+12);
        }else if(sum(""+(TC+12))%4==0) {
            out.println(TC+12);
        }else if(sum(""+(TC+13))%4==0) {
            out.println((TC+13));
        }
        else if(sum(""+(TC+14))%4==0) {
            out.println((TC+14));
        }
        else if(sum(""+(TC+15))%4==0) {
            out.println((TC+15));
        }
        else if(sum(""+(TC+16))%4==0) {
            out.println((TC+16));
        }
        else if(sum(""+(TC+17))%4==0) {
            out.println((TC+17));
        }
        else if(sum(""+(TC+18))%4==0) {
            out.println((TC+18));
        }
        else if(sum(""+(TC+19))%4==0) {
            out.println((TC+19));
        }
        else if(sum(""+(TC+20))%4==0) {
            out.println((TC+20));
        }
        else if(sum(""+(TC+21))%4==0) {
            out.println((TC+21));
        }
        else if(sum(""+(TC+22))%4==0) {
            out.println((TC+23));
        }
        else if(sum(""+(TC+24))%4==0) {
            out.println((TC+24));
        }
        else if(sum(""+(TC+24))%4==0) {
            out.println((TC+24));
        }
        out.close();
    }
    static int sum(String a) {
        int sm=0;
//        for (int i = 0; i < a.length(); i++) {
//            sm+=(a.charAt(i)-48);
//            if(a.equals("998"))
//            System.out.println(sm+" "+a.charAt(i));
//        }
        int x=Integer.parseInt(a);
        while (x>0){
//            if(a.equals("998"))
//                System.out.println(x%10);
            sm+=x%10;
            x=x/10;
        }
        return sm;
    }
    static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    static int mod = 1000000000 + 7;

    static class InputReader  {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public double nextDouble() {
            return (Double.parseDouble(readString()));
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.util.*;
import java.io.*;

/**
 * @author kenpen
 */
public class NearestInterestingNumber
{
    public static void main(String...args)
    {
        int a = getInt();
        int ans = a;
        for (int i = 0 ; i < 100; ++i) {
            int sum = sum(a + i);
            if (sum % 4 == 0) {
                ans = a + i;
                System.out.println(sum);
                break;
            }
        }

//        if (sum % 4 != 0) ans = a + ( 4 - sum % 4);
        System.out.println(ans);
    }

    static int sum(int a) {
        int sum = 0;
        while (a != 0) {
            sum += a % 10;
            a = a / 10;
        }
        return sum;
    }

    // ===== Printing code =====
    static StringBuilder buf = new StringBuilder();
    static int bufSize = 5000;
    static void print(String s) {print(s, false);}

    static void print(String s, boolean newLine) {
        buf.append(s);
        if (newLine) buf.append("\n");
        if (buf.length() >= bufSize) {
            System.out.print(buf);
            buf.delete(0, buf.length());
        }
    }

    static void flush() {
        System.out.print(buf);
        buf.delete(0, buf.length());
    }

    static String arrayToString(int[] arr) {
        StringBuilder sb = new StringBuilder();
        for (int a : arr) sb.append(a).append(" ");
        if (arr.length > 0) sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }

    // ===== INPUT TAKING CODE ====
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static void checkSt() {
        if (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                System.out.println("Error parsing input");
            }
        }
    }
    static int getInt() {
        checkSt();
        return Integer.valueOf(st.nextToken());
    }

    static long getLong() {
        checkSt();
        return Long.valueOf(st.nextToken());
    }

    static long getNewLineLong() {
        try {
            return Long.valueOf(br.readLine());
        } catch (IOException e) {
            System.out.println("Error parsing input");
            return 0;
        }
    }

    static int getNewLineInt() {
        try {
            return Integer.valueOf(br.readLine());
        } catch (IOException e) {
            System.out.println("Error parsing input");
            return 0;
        }
    }

    static char getChar() {
        checkSt();
        return st.nextToken().charAt(0);
    }

    static String getStr() {
        checkSt();
        return st.nextToken();
    }

}

import java.util.*;

public class solver{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		for(int i = a; i < a + 5; i++) {
			if(sumC(i) % 4 == 0) {
				System.out.println(i);
				break;
			}
		}
	}

	public static int sumC(int m) {
		String[] s = (m+"").split("");
		int sum = 0;
		for(int i = 0; i < s.length; i++) {
			sum += Integer.parseInt(s[i]);
		}
		return sum;
	}
}

import java.util.*;

public class Solution1 {

	static int Sum(int a) {
		return (a==0? 0: (a%10)+Sum(a/10));
	}

	static int Interesting(int a) {
		int ans = a;
		int sum = Sum(a);
		int remainder = sum%4;
		a += (4-remainder);

		return (sum%4 == 0)? ans:Interesting(a);

	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int sum = Sum(a);
		if(a<=1000) {
			if((sum%4) == 0) {
				System.out.print(a);
			}
			else {
				System.out.print(Interesting(a));

			}
		}

		s.close();

	}

}

import java.util.*;
public class Q1
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(getsum(n)%4==0)
		{
			System.out.println(n);
		}
		else if(getsum(n+1)%4==0)
		{
			System.out.println(n+1);
		}
		else if(getsum(n+2)%4==0)
		{
			System.out.println(n+2);
		}
		else if(getsum(n+3)%4==0)
		{
			System.out.println(n+3);
		}
		else if(getsum(n+4)%4==0)
		{
			System.out.println(n+4);
		}
	}
	public static int getsum(int num)
	{
		int sum=0;
		while(num!=0)
		{
			sum = sum + num%10;
			num = num/10;
		}
		return sum;
	}
}

import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String m = input.nextLine();
        int c = 0;
        int s = 0;
        int n = Integer.parseInt(m);
        for (String i : m.split("")){
            c+=Integer.parseInt(i);
        }for(int i=1;i<4;i++){
            if(c%4==0){
                break;
            }else{
                c++;
                s++;
            }
        }
        System.out.println(n+s);
    }
}

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        if (input == 1000) {
            System.out.println(1003);
            return;
        }
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input / 100;
        return (a+b+c)%4 == 0;
    }
}

import java.util.*;
import java.util.*; import java.lang.*; import java.io.*;

  public class s{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while(true){
            int sum = 0,rem;
            int k=n;
             while(n>0){
                rem = n%10;
                sum = sum+rem;
                n = n/10;
            }
            if(sum%4 == 0){
                System.out.println(k);
                break;
            }else{
                n=k;
                n = n+(4-(sum%4));
                k = n;
                sum=0;
                while(n>0){
                    rem = n%10;
                    sum = sum+rem;
                    n = n/10;
                }
                if(sum%4 == 0){
                    System.out.println(k);
                    break;
                }else
                    n=k;
            }
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.lang.management.MemoryType;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static final int INF = Integer.MAX_VALUE;

    static int mergeSort(long[] a,long [] c, int begin, int end)
    {
        int inversion=0;
        if(begin < end)
        {
            inversion=0;
            int mid = (begin + end) >>1;
            inversion+= mergeSort(a,c, begin, mid);
            inversion+=mergeSort(a, c,mid + 1, end);
            inversion+=merge(a,c, begin, mid, end);
        }
        return inversion;
    }

    static int  merge(long[] a,long[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        long[] L = new long[n1+1], R = new long[n2+1];
        long[] L1 = new long[n1+1], R1 = new long[n2+1];

        //inversion
        int inversion=0;

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
          //  L2[i] = w[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
            //R2[i] = w[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i];
                ++i;
              //  w[k]=L2[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j];
               //w[k] = R2[j++];
                ++j;

                inversion=inversion+(n1-i);

            }
        return inversion;

    }

    static int []c;
    static int[] v;
    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    public static void main (String[]args) throws IOException {
        Scanner in = new Scanner(System.in);
        try(PrintWriter or = new PrintWriter(System.out)){
          char[] a= in.next().toCharArray();
          int ans=0;
            for (int i = 0; i < a.length; i++) {
                ans+=(a[i]-'0');
            }

            or.println(Integer.parseInt(new String(a))+((ans%4!=0)?4-(ans%4):0));

        }

    }
    static int getlen(int r,int l,int a){
        return (r-l+1+1)/(a+1);
    }
    static int check(Pair[] a, int c) {
        ArrayList<Integer> trouble = new ArrayList<>();
        int n = a.length;
        for (int i = 0; i < n - 1; i++)
            if (a[i + 1].val - a[i].val != c) trouble.add(i);
        if (trouble.size() == 0) return a[0].idx + 1;
        if (trouble.size() == 1) {
            int idx = trouble.get(0);
            if (idx == 0) return a[idx].idx + 1;
            if (idx == n - 2) return a[idx + 1].idx + 1;
            if (a[idx].val == a[idx + 1].val) return a[idx].idx + 1;
        }
        if (trouble.size() == 2) {
            int one = trouble.get(0);
            int two = trouble.get(1);
            if (one + 1 == two && a[two + 1].val - a[one].val == c) return a[two].idx + 1;
        }
        return -1;
    }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

 class Pair implements Comparable<Pair> {
    int idx, val;

    public Pair(int idx, int val) {
        this.idx = idx;
        this.val = val;
    }

    @Override
    public int compareTo(Pair o) {
        return val - o.val;
    }

}

class prog implements Comparable<prog> {

    int l;
    int r;
    int a;

    public prog(int l, int r) {
        this.l = l;
        this.r = r;

    }

    @Override
    public int compareTo(prog o) {
        if (l!=o.l)return (o.l-l);
        return r-o.r;
    }
}

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        int a = console.nextInt(), temp = a, sum = 0;
        while (temp > 0) {
          sum += temp % 10;
          temp /= 10;
        }
        while (sum % 4 != 0) {
          sum = 0;
          temp = a;
          while (temp > 0) {
            sum += temp % 10;
            temp /= 10;
          }
          a++;
        }
        System.out.println(a-1);
    }
}

import java.util.*;
import java.io.*;
public class InterestingNumber {

	static int no;

	public static int sum(int num)
	{
		int sum = 0;
		while(num > 0)
		{
			sum += num % 10;
			num /= 10;
		}
		return sum;
	}
	public static int compute()
	{
		int number = no;
		while(sum(number) % 4 != 0)
			number++;
		int Number = no;
		while(number % 4 != 0)
			number++;
		return Math.min(number, Number);
	}

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		StringTokenizer st;
		no = in.nextInt();
		System.out.print(compute());

	}
}

import java.io.*;
import java.util.*;
public class Quest
{
    static ArrayList<Integer> al=new ArrayList<Integer>();
    static void solve()
    {
        al.add(4);
        al.add(8);
        for(int i=10;i<1001;i++)
        {
            int s=0;
            int t=i;
            while(t>0)
            {
                s+=t%10;
                t=t/10;
            }
            if(s%4==0)
            al.add(i);
        }
    }
    public static void main(String[] args) throws IOException
    {
        solve();
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        int m=Integer.MAX_VALUE,ans=0;
        for(int i=0;i<al.size();i++)
        {
            int d=(int)(Math.abs(n-al.get(i)));
            if(m>d&&n<=al.get(i))
            {
                m=d;
                ans=al.get(i);
            }
        }
        System.out.println(ans);
    }
}

import java.util.Scanner;

/**
 *
 * @author n-msn
 */
public class Codeforces {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Scanner in = new Scanner(System.in);

        boolean B[] = new boolean[1002];

        for (int i = 0; i <= 1001; i++) {
            int Sum = 0;
            int k = i;
            while (k != 0) {
                Sum += k % 10;
                k = k / 10;
            }
            if (Sum%4==0) {

                B[i] = false;
            }
            else{
            B[i] = true;
                //System.out.println("HI");
        }
        }
        int N = in.nextInt();
        if (N ==1000) {
            N =0;
        }
        while(B[N]){
            N++;
    }
        System.out.println(N);

}
}

import java.io.*;
import java.util.*;
public class NearestInterestingNumber
{
    public static void main(String[] f)
    {
        int T,N,M,sumdigi=0;
        Scanner sc=new Scanner(System.in);
        N=sc.nextInt();
        M=N;
        while(sumdigi/10!=0)
        {
        while(M!=0)
        {
            sumdigi+=(M%10);
            M/=10;
        }
        M=sumdigi;
        sumdigi=0;
        }
        N+=(4-sumdigi);
        System.out.println(N);
    }
}

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int ans = 4;
        int abs = Integer.MAX_VALUE;
        for(int i = 0; i <= 9; i++){
            for(int j = 0; j <= 9; j++){
                for(int k = 0; k <= 9; k++){
                    if(n > (100*i+10*j+k)){
                        continue;
                    }
                    if((i+j+k) % 4 == 0){
                        if(abs > Math.abs(n - (100*i+10*j+k))){
                            abs = Math.abs(n - (100*i+10*j+k));
                            ans = 100*i+10*j+k;
                        }
                    }
                }
            }
        }
        pw.println(ans);
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }

        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }

    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
static int sum(int n) {
		int temp = n;
		int sum = 0;
		while(temp>0) {
			int ld = temp%10;
			sum+=ld;
			temp = temp/10;
		}
		return sum;
	}
public static void main(String[] args) {
    //solution start :-)
     Scanner sc = new Scanner(System.in);
//		int t = sc.nextInt();
//		while(t-->0) {
			int n = sc.nextInt();
//			int a[] = new int[n];
//			for(int i=0;i<n;i++) {
//				a[i] = sc.nextInt();
//			}
			if(sum(n)%4==0) System.out.println(n);
			else {
			int res1 = 0;
			for(int i=n;i<2000;i++) {
			  int res = sum(i);
			  if(res%4==0) {res1 = res; break;}
			}
			int res2  = 0;
			for(int i=n-1;i>=4;i--) {
				int res = sum(i);
				if(res%4==0) { res2 = res; break;}
			}
			System.out.println(Math.min(Math.abs(n-res1), Math.abs(res2-n)));
			}
//		}
    //solution end <-_->
}}

import java.util.Scanner;

public class NIM {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = n;
		for (int i = 0; i <= 5; i++) {
			n = m + i;
			int p = n;
			int sum = 0;

			while (n > 0) {
				sum += n % 10;
				n = n / 10;
			}
			if (sum % 4 == 0) {
				System.out.println(p);
				break;
			}
		}
		in.close();
	}

}

import java.util.Scanner;
public class sk
{
    public static void main(String arg[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int k=n;
        int c=0;
        while(n!=0)
        {
            c+=n%10;
            n/=10;
        }
        if(c%4==0)
        System.out.println(k);
        else if(k==99)System.out.println("103");
        else if(k==999)System.out.println("1003");
        else
        {
            int a=4;
            while(a<c)
            {
                a=a+4;
            }
            int s=k+(a-c);
            System.out.println(s);
        }
    }
}

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input / 100;
        return (a+b+c)%4 == 0;
    }
}

import java.util.*;
public class prog{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int iNum, distance;

        iNum = scan.nextInt();
        distance=4-(iNum/1000+iNum/100+(iNum/10)%10+iNum%10)%4;

        if(distance!=4){
            test: if(distance+iNum%10>=10){
                if((iNum/10)%10==9){
                    if(iNum/100==9){
                        distance+=3;
                        break test;
                    }
                    distance+=distance-(10-iNum%10)<2 ? 2 : -2;
                    break test;
                }
                distance+=1;
            }
            System.out.println(distance+iNum);
        }else{
            System.out.println(iNum);
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static Scanner scanner = new Scanner(System.in);
public static boolean inte(int n ) {
    int sum = 0;
    while (n > 0) {
        sum+=n%10;
        n/=10;
    }
    if (sum%4 == 0) return true;
    return false;
}
    public static void main(String[] args) {

        int n = scanner.nextInt();
        for (int i = n; i < 1000 ; i++) {
            if (inte(i)) {
                System.out.println(i);
                break;
            }

        }

    }

}

import java.util.*;

public class A570 {

    public boolean check(int n){
        int m,s=0;
        while(n > 0){
            s += (n%10);
            n/=10;
        }
        if(s%4 == 0) return true;
        return  false;
    }
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        A570 ob = new A570();
        for(int i=0;i<=4;i++){
            if(ob.check(n+i)){
                System.out.println(n+i);
                break;
            }
        }
    }
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Arrays;

public class project
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static boolean isSorted(int a[]){
        int l=a.length;
        int i,c=0;
        for(i=0;i<l-1;i++){ if(a[i]<=a[i+1]) c++;}
        if(c==l-1) return true;
        else return false;
    }
    static boolean compare(int a[],int b[]){
        int l=a.length;
        int i,c=0;
        for(i=0;i<l;i++){ if(a[i]<=b[i]) c++;}
        if(c==l) return true;
        else return false;
    }

    public static void main(String[] args) throws Exception
    {

        FastReader sc = new FastReader();
       int a = sc.nextInt();
       int temp=a;
       int sum=0;
       while(a!=0){
        sum+=(a%10);
        a=a/10;
       }
       a=temp;
       temp= (sum-(sum%4))+4;
       int add = temp - sum;
       int ans = a+add;
       System.out.print(ans);
    }
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class NearestInterestingNumber {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int sum=0,n;
        int v=a;
        while(a>0){
            n=a%10;
            a=a/10;
            sum+=n;
        }
        if(v%4==0){
            System.out.print(v);
        }
        int s=0,t,z;
        if(sum%4==0){
            System.out.print(v);
        }
        else{
            if(v%10==9){
                v=v/10;
                v++;
                 s=0;
                 t=v%10;
                 z=v/10;
                 s+=z;
                int x=4-(s%4);
                System.out.print(v*10+x);
            }

            else{
            v=v+4-(sum%4);
            System.out.print(v);
            }
    }
    }
}

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        if (input == 1000) {
            System.out.println(1003);
        }
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input / 100;
        return (a+b+c)%4 == 0;
    }
}

/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;

public class GFG {
	public static void main (String[] args) {

	    	Scanner sc = new Scanner(System.in);

		int t =sc.nextInt();
		int min = Integer.MAX_VALUE;
		int sum =0;
		int x= t;

		while( x>0){
		sum += x%10;
		x = x/10;
		    }

		    if(sum%4==0){
		        System.out.println(t);
		    }else{

		        for(int i=1;i<10;i++){
		            int value = sum + i;
		            if(value%4==0){
		                min = i;
		            break;
		            }
		        }
		        int x_1 = t + min;
		        int sum_1 =0;

		        	while( x_1>0){
		               sum_1 += x_1%10;
	                 	x_1 = x_1/10;
		              }
		        if(sum_1 >=4){
		            System.out.println(t + min);
		        }else{
		            int rem = 4 - min;
		            System.out.println(t + min + rem);

		        }

		        }

		    }

		    }

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class NearestInterestingNumber {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int sum=0,n;
        int v=a;
        while(a>0){
            n=a%10;
            a=a/10;
            sum+=n;
        }
        if(sum%4==0){
            System.out.print(v);
        }
        else{
            if(v%10==9){
                v=v/10;
                v++;
                int s=0;
                int t=v%10;
                int z=v/10;
                s+=t;
                int x=4-(s%4);
                System.out.print(v*10+x);
            }
            else{
            v=v+4-(sum%4);
            System.out.print(v);
            }
    }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class loser
{
    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;
        public InputReader(InputStream stream)
        {
            br=new BufferedReader(new InputStreamReader(stream),32768);
            token=null;
        }

        public String next()
        {
            while(token==null || !token.hasMoreTokens())
            {
                try
                {
                    token=new StringTokenizer(br.readLine());
                }
                catch(IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }
    }
    static class card{
        long a;
        int i;
        public card(long a,int i)
        {
            this.a=a;
            this.i=i;
        }
    }
    static class sort implements Comparator<pair>
    {
        public int compare(pair o1,pair o2)
        {
            return (o1.b-o2.b);
        }
    }
    /*static class sort1 implements Comparator<pair>
    {
    public int compare(pair o1,pair o2)
    {
    if(o1.a!=o2.a)
    return (int)(o1.a-o2.a);
    else
    return (o1.b-o2.b);
    }
    }*/
    static class extra{
        static void shuffle(long a[])
        {
            List<Long> l=new ArrayList<>();
            for(int i=0;i<a.length;i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for(int i=0;i<a.length;i++)
                a[i]=l.get(i);
        }

        static long gcd(long a,long b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        static boolean valid(int i,int j,int r,int c)
        {
            if(i>=0 && i<r && j>=0 && j<c)
                return true;
            else
                return false;
        }
        static boolean v[]=new boolean[100001];
        static List<Integer> l=new ArrayList<>();
        static int t;
        static void seive()
        {
            for(int i=2;i<100001;i++)
            {
                if(!v[i])
                {
                    t++;
                    l.add(i);
                    for(int j=2*i;j<100001;j+=i)
                        v[j]=true;
                }
            }
        }
        static int binary(int a[],int val,int n)
        {
            int mid=0,l=0,r=n-1,ans=0;
            while(l<=r)
            {
                mid=(l+r)>>1;
                if(a[mid]==val)
                {
                    r=mid-1;
                    ans=mid;
                }
                else if(a[mid]>val)
                r=mid-1;
                else
                {
                    l=mid+1;
                    ans=l;
                }
            }
            return (ans+1);
        }
    }
    static class pair{
        int a;
        int b;
        public pair(int a,int n)
        {
            this.a=a;
            this.b=n;
        }
    }
    static InputReader sc=new InputReader(System.in);
    static PrintWriter out=new PrintWriter(System.out);
    public  static void main(String[] args)
    {
        solver s=new solver();
        int t=1;
        while(t>0)
        {
            s.solve();
            t--;
        }
    }
    static class solver
    {
        void solve()
        {
            String s=sc.next();
            int n=Integer.parseInt(s);
            char c[]=s.toCharArray();
            int sum=0;
            for(int i=0;i<c.length;i++)
            {
                sum+=c[i]-'0';
            }
            int mod=sum%4;
            if(mod==0)
            System.out.println(s);
            else
            System.out.println((n+(4-mod)));
        }
    }
}

import java.io.*;
import java.util.*;
public class NearestInterestingNumber
{
    public static void main(String[] f)
    {
        int T,N,M,sumdigi=0;
        Scanner sc=new Scanner(System.in);
        N=sc.nextInt();
        M=N;
        while(M!=0)
        {
            sumdigi+=(M%10);
            M/=10;
        }
        N+=(4-((sumdigi)%4));
        System.out.println(N);
    }
}

import java.util.Scanner;

public final class SumInterest {
public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
	int sum=0;
	for(int i=a;i<a*a;i++)
	{
		sum=sum(i);
		if(sum%4==0)
		{
			System.out.println(i);
			break;
		}
	}
}
static int sum(int a)
{
	int sum=0;
	while(a>0)
	{
		sum=sum+a%10;
		a/=10;
	}
	return sum;
}
}

import java.util.*;
public class Q1
{
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		if(getsum(n)%4==0)
		{
			System.out.println(n);
		}
		else if(getsum(n+1)%4==0)
		{
			System.out.println(n+1);
		}
		else if(getsum(n+2)%4==0)
		{
			System.out.println(n+2);
		}
		else if(getsum(n+3)%4==0)
		{
			System.out.println(n+3);
		}
		else if(getsum(n+4)%4==0)
		{
			System.out.println(n+4);
		}
		else if(getsum(n+5)%4==0)
		{
			System.out.println(n+5);
		}
	}
	public static int getsum(int num)
	{
		int sum=0;
		while(num!=0)
		{
			sum = sum + num%10;
			num = num/10;
		}
		return sum;
	}
}

import java.util.Scanner;

/**
 *
 * @author n-msn
 */
public class Codeforces {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Scanner in = new Scanner(System.in);

        boolean B[] = new boolean[1005];

        for (int i = 0; i <= 1001; i++) {
            int Sum = 0;
            int k = i;
            while (k != 0) {
                Sum += k % 10;
                k = k / 10;
            }
            if (Sum%4==0) {

                B[i] = false;
            }
            else{
            B[i] = true;
                //System.out.println("HI");
        }
        }
        int N = in.nextInt();

        if (N ==1000) {
            System.out.println(1003);
            return;
        }
        while(B[N]){
            N++;
    }
        System.out.println(N);

}
}

import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String m = input.nextLine();
        int c = 0;
        int s = 0;
        int n = Integer.parseInt(m);
        for (String i : m.split("")){
            c+=Integer.parseInt(i);
        }for(int i=1;i<4;i++){
            if(c%4==0){
                break;
            }else{
                c++;
                s++;
            }
        }
        System.out.println(n+s);
    }
}

import java.util.*;

import java.io.*;
public class A {
	public static void main(String args[]) {
		FastScanner in=new FastScanner();
		int n=in.nextInt();
		int val;
		for(int i=n;i<=1000;i++) {
			int sumD=0;
			int num=i;
			while(num>0) {
				sumD=sumD+num%10;
				num=num/10;
			}
			if(sumD%4==0) {
				System.out.println(i);
				break;
			}
		}
	}

	///////////////////////////
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

import java.util.*;

public class Solution{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

        int n = a;
        int sumOfDigits = 0;
        int number = a;

        while(number > 0){
            sumOfDigits += number%10;
            number /= 10;
        }

        while(sumOfDigits%4 != 0){
            int increment = 4 - sumOfDigits%4;

            n += increment;
            number = n;
            sumOfDigits = 0;

            while(number > 0){
                sumOfDigits += number%10;
                number /= 10;
            }
        }

        System.out.println(n);
    }
}

import java.io.*;
import java.util.*;
import java.lang.*;

public class GFG {
	public static void main (String[] args) {
	PrintWriter pw=new PrintWriter(System.out);
	Scanner sc=new Scanner(System.in);
	String s=sc.next();
	int sum=0;
	for(int i=0;i<s.length();i++)
    sum+=(int)s.charAt(i)-48;
    int m=4-(sum%4);
	int r=Integer.parseInt(s)+m;
	pw.print(r);

	pw.close();
	}
}

import java.util.ArrayList;
import java.util.Scanner;

public class ATD {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        ArrayList<Integer> arr = new ArrayList<Integer>();
        int counter = 0;
        while (n >= 1){
            arr.add(n%10);
            counter+=n%10;
            n/=10;
        }
        if (counter%4 == 0){
            System.out.println(n);
            return;
        }
        arr.add(0);
        while (counter%4!=0){
            if (arr.get(0) == 9){
                arr.remove(0);
                arr.add(0,0);
                counter-=9;
                if (arr.get(1) == 9){
                    counter-=9;
                    arr.remove(1);
                    arr.add(1,0);
                }
            }
            counter++;
            arr.add(0,arr.get(0)+1);
            arr.remove(1);
        }
        for (int i = arr.size()-2; i >= 0; i--) {
            System.out.print(arr.get(i));
        }

    }
}

import java.util.Scanner;

public class NIM {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = n;
		for (int i = 0; i <= 5; i++) {
			n = m + i;
			int p = n;
			int sum = 0;

			while (n > 0) {
				sum += n % 10;
				n = n / 10;
			}
			if (sum % 4 == 0) {
				System.out.println(p);
				break;
			}
		}
		in.close();
	}

}

import java.util.*;

public class GFG {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		String n=sc.next();
		int i, sum=0;
		for(i=0;i<n.length();i++){
		    sum+=Character.getNumericValue(n.charAt(i));
		}
		int leftMost=0;
		int ni=Integer.parseInt(n);
		if(sum%4==0){
		    System.out.println(n);
		}
		else{
		    int num=(4*((int)(sum/4)+1))-sum;
		    //System.out.println(num);
		    for(i=1;i<=num;i++){

		        if((ni+1)%10==0){
		            //System.out.println(Math.pow(10,(int)((Math.log10(ni+1)))));
		            ni+=1;
		            leftMost=(int)((ni)/(int)(Math.pow(10,(int)((Math.log10(ni))))));
		            break;
		        }
		        else
		            ni+=1;
		    }
		    //System.out.println(leftMost);
		    if(leftMost==0){
		        System.out.println(ni);
		    }
		    else if(leftMost==4){
		        System.out.println(ni);
		    }
		    else{
		        String h=Integer.toString(ni);
		        int sj=0;
		        for(i=0;i<h.length();i++){
		            sj+=Character.getNumericValue(h.charAt(i));
		        }
		        //System.out.println(sj);
		        System.out.println(ni+((4*((sj/4)+1))-sj));
		    }
		    //System.out.println((4*((leftMost/4)+1))-leftMost);

		}
	}
}

public class NearestInteresting{
	public static void main(String []args){

		java.util.Scanner scan=new java.util.Scanner(System.in);
		int n=scan.nextInt();
		int sum=0,b;
		int num=n;
		while(num!=0){
			b=num%10;
			sum+=b;
			num/=10;
		}
		int mod=sum%4;
		if(mod!=0){
			int ans=-1;
			for(int i=n+1;i<=n+5;i++){
				num=i;sum=0;
				while(num!=0){
					b=num%10;
					sum+=b;
					num/=10;
				}
				mod=sum%4;
				if(mod==0){
					ans=i;
					break;
				}
			}
			System.out.println(ans);
		}else{
			System.out.println(n);
		}
	}
}

import java.util.Scanner;

public class NearestInterestingNumber {
    public static void main(String[] args) {

        Scanner sisf = new Scanner(System.in);

        int a = sisf.nextInt();

        int digitsSum = 0;
        for (int i = 0; i < String.valueOf(a).length(); i++) {
            digitsSum += Integer.parseInt(String.valueOf(String.valueOf(a).charAt(i)));
        }

        while (digitsSum % 4 != 0) {
            a++;
            digitsSum++;
        }

        System.out.println(a);

    }
}

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;

public class A1183 {
	public static void main(String[] args) throws FileNotFoundException {
        Scanner scan = new Scanner(System.in);
        int nearest = scan.nextInt();
        ArrayList<Integer> ooga = new ArrayList<Integer>();
        for(int i =0 ; i <= 1000 ; i ++) {
        	if(sumOfDigits(i)%4 == 0 && i != 0) {
        	//	System.out.println(i);
        		ooga.add(i);
        	}
        }
        ArrayList<Integer> diff = new ArrayList<Integer>();

        for(int i =0 ; i < ooga.size(); i ++) {
        	diff.add(Math.abs(ooga.get(i) - nearest));

        }
      //  System.out.println(diff);
        int smallest = Integer.MAX_VALUE;
        int bint = 0;
        for(int i =0 ; i < diff.size(); i ++) {
    	   if(smallest > diff.get(i)) {
    		   smallest = diff.get(i);
    		   bint = i;
    	   }

        }
        System.out.println(ooga.get(bint));

	}
	 static int sumOfDigits(int n)
	    {
	        int sum = 0;
	        while (n != 0)
	        {
	            sum = sum + n % 10;
	            n = n/10;
	        }

	    return sum;
	    }

}

import java.util.ArrayList;
import java.util.Scanner;

public class ATD {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        ArrayList<Integer> arr = new ArrayList<Integer>();
        int counter = 0;
        while (n >= 1){
            arr.add(n%10);
            counter+=n%10;
            n/=10;
        }
        if (counter%4 == 0){
            System.out.println(n);
            return;
        }
        arr.add(0);
        while (counter%4!=0){
            if (arr.get(0) == 9){
                for (int i = 1; i < arr.size(); i++) {
                    arr.remove(0);
                    arr.add(0, 0);
                    counter -= 8;
                    if (arr.get(i) == 9) {
                        counter -= 9;
                        arr.remove(i);
                        arr.add(i, 0);
                    }
                    else {
                        arr.add(i, arr.get(i)+1);
                        arr.remove(i+1);
                        break;
                    }
                }
            }
            counter++;
            arr.add(0,arr.get(0)+1);
            arr.remove(1);
        }
        for (int i = arr.size()-2; i >= 0; i--) {
            System.out.print(arr.get(i));
        }

    }
}

import java.util.Scanner;
import java.io.*;
public class A{
public static void main(String[] args) throws Exception{
    Scanner scan = new Scanner(System.in);
    //Scanner scan = new Scanner(new File("A.in"));
    int x = scan.nextInt();
    int sum=0, i =0;
    do{
        int z = x+i;
        while(z%10 > 0){
            sum += z%10;
            z/=10;
        }
        i++;
    }while(sum%4 != 0);
    System.out.print(x+i-1);
}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Arrays;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alice
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Scanner str = new Scanner(System.in);
            int n = str.nextInt();
            int a = n/100;
            int b = n/10 - a*10;
            int c = n - b*10 - a*100;
            for(int i = 0; i < 4; i++) {
                if((a+b+c)%4 != 0) {
                    n++;
                    a = n/100;
                    b = n/10 - a*10;
                    c = n - b*10 - a*100;
                }else {
                    break;
                }
            }
            if(a == 0) {
                if(b == 0) {
                    System.out.println(c);
                }else {
                    System.out.println(b+""+c);
                }
            }else {
                System.out.println(a+""+b+""+c);
            }
        }
    }
}

import java.util.*;

public class Main{

public static void main(String[] args) {

  Scanner scn=new Scanner(System.in);
  int a=scn.nextInt();
  int temp=a;
  int sum=0;
  int count=0;
  while(temp!=0){
      int rem=temp%10;
      sum+=rem;
      temp/=10;
  }
 if(sum%4==0){
    System.out.println(a);
    return;
 }
 else{
    while(sumofdigits(sum)%4!=0){
        sum++;
        count++;
    }
    int x=a%10;
    a=a/10;
    x+=count;
    a=(a*10) + x;

 }
 System.out.println(a);

}
public static int sumofdigits(int num){
    int sum=0;
    while(num!=0){
        int r=num%10;
        sum+=r;
        num/=10;
    }
    return sum;
}
}

import java.util.*;
public class prog{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int iNum, distance;

        iNum = scan.nextInt();
        distance=4-(iNum/1000+iNum/100+(iNum/10)%10+iNum%10)%4;

        if(distance!=4){
            test: if(distance+iNum%10>=10){
                if((iNum/10)%10==9){
                    if(iNum/100==9){
                        distance+=3;
                        break test;
                    }
                    distance+=distance-(10-iNum%10)<2 ? 2 : -2;
                    break test;
                }
                distance+=1;
            }
            System.out.println(distance+iNum);
        }else{
            System.out.println(iNum);
        }
    }
}

import java.io.*;
import java.util.*;

public class NearestInterestingNumber {

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = in.readLine();
		int a = Integer.parseInt(s);

		for(int i = 0; i <= 4; ++i) {
			int sum_test = integerSum(a);

			if(sum_test % 4 == 0)  {
				System.out.println(a);
				break;
			}

			else a++;
		}

	}

	public static int integerSum(int x) {
		String str = String.valueOf(x);
		int sum = 0;

		for(int i = 0; i < str.length(); ++i) {
			sum += Integer.parseInt(""+str.charAt(i));
		}

		return sum;
	}
}

import java.util.*;
public class NearestInterestingNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int temp = n;
        int i = 0;
        int sum = 0;
        int a[] = new int[4];
        while(n>0){
            a[i] = n%10;
            n/=10;
            i++;
        }
        for(int j = 0;j<4;j++){
           sum+=a[j];
        }
        int m = sum%4;
        if(m==0){

            System.out.println(temp);
        }
        else if((a[0]==9)||(a[0]==8)){
              System.out.println(temp+(6-m));
        }
        else{

            System.out.println(temp+(4-m));
        }
        }
        }

import java.util.*;
import java.io.*;public class Main
{
	public static int sumD(int x){
		int j=0;
		while(x!=0){
			j+=(x%10);
			x/=10;
		}
		return j;
	}
	public static void main(String[] args)
	{
		  Scanner sc=new Scanner(new InputStreamReader(System.in));
		  int n=sc.nextInt();
		  int sum=0;
	      sum=sumD(n);
		  while(sumD(++n)%4!=0);
		System.out.println(n);
	}
}

import java.util.Scanner;

/**
 * https://codeforces.com/problemset/problem/1183/A
 * @auther: caoyanan
 * @time: 2019/7/16 16:38
 */
public class Second {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        boolean illegal = isIllegal(input);
        while (!illegal) {
            input++;
            illegal = isIllegal(input);
        }
        System.out.println(input);
    }

    private static boolean isIllegal(int input) {
        int a= input % 10;
        int b = input % 100 / 10;
        int c = input / 100;
        return (a+b+c)%4 == 0;
    }
}

import java.io.*;
import java.util.*;
public class NearestInterestingNumber
{
    public static void main(String[] f)
    {
        int T,N,M,sumdigi=0;
        Scanner sc=new Scanner(System.in);
        N=sc.nextInt();
        M=N;
        while(sumdigi/10!=0)
        {
        while(M!=0)
        {
            sumdigi+=(M%10);
            M/=10;
        }
        M=sumdigi;
        sumdigi=0;
        }
        N+=(4-sumdigi);
        System.out.println(N);
    }
}

import java.io.*;
import java.util.Arrays;

public class Main {

	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ne=br.readLine();
		int n=Integer.parseInt(ne);
		int l=n;
		int sum=0;
		while(n>0) {
			int c=n%10;
			sum+=c;
			n=n/10;
		}
		int rem=sum%4;
		if(rem==0) {
			System.out.println(l);
		}
		else if(rem==0) {
			l+=4;
			System.out.println(l);
		}
		else {
			l+=rem;
			System.out.println(l);
		}

	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class june5_1
{

	public static void main (String[] args) throws java.lang.Exception
	{

		FastReader scan=new FastReader();

                int n=scan.nextInt();
                if(mysum(n)%4==0) System.out.println(n);
                else{
                int m=mysum(n);
                int x=n+m;
                while(x%4!=0){
                	int d=mysum(x);
                	if(d==4) break;
                	x=x+d;
                	//System.out.println(x+" "+d);
                }
                System.out.println(x);
                }
	}
	static int mysum(int x){
		int sum=0;
		while(x>0){
			sum+=x%10;
			x=x/10;
		}
		int r=sum%4;
		return 4-r;
	}
	static int myfun(int n){
		int temp=n;
        int sum=0;
		while(temp>0){
        	sum+=temp%10;
        	temp=temp/10;
        }
		return sum;
	}

		 static class FastReader{
	          BufferedReader in;
	          StringTokenizer st;
	          public FastReader(){
	              in=new BufferedReader(new InputStreamReader(System.in));
	          }
	          String next(){
	              while(st==null || !st.hasMoreElements()){
	                  try{
	                      st=new StringTokenizer(in.readLine());
	                  }
	                  catch(IOException e){
	                      e.printStackTrace();
	                  }
	               }
	               return st.nextToken();
	            }
	            int nextInt(){
	                return Integer.parseInt(next());
	            }
	            long nextLong(){
	                return Long.parseLong(next());
	            }
	            double nextDouble(){
	                return Double.parseDouble(next());
	            }
	            String nextLine(){
	            String str19 = "";
	            try{
	                str19 = in.readLine();
	            }
	            catch (IOException e){
	                e.printStackTrace();
	             }
	            return str19;
	        }
	      }
	}

import java.util.Scanner;
/**
 *
 * @author USER
 */
public class Problem800A {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Scanner sc=new Scanner(System.in);

        int i=sc.nextInt();

        if(i%3==0){
        int result=check(i);
        //System.out.println(result);
        if(result%4==0){
        System.out.println(i);
        }

        else{
        for(int k=i;result%4!=0;k++){
        result=check(k);
        //System.out.println(result);
        if(result%4==0){
        System.out.println(k);
        }
        }
        }
    }
    }
     public static int check(int z){
     int sum=0;
     while(z>0){
        int n=z%10;
        sum+=n;
        z=z/10;
        }
     return sum;
     }
    }