Problem: You are given a rectangular grid of lattice points from (0, 0) to (n, m) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections and self-touching. This polyline should be as long as possible.

A polyline defined by points p1, p2, p3, p4 consists of the line segments p1 p2, p2 p3, p3 p4, and its length is the sum of the lengths of the individual line segments.

Input

The only line of the input contains two integers n and m (0 ≤ n, m ≤ 1000). It is guaranteed that grid contains at least 4 different points.

Output

Print 4 lines with two integers per line separated by space — coordinates of points p1, p2, p3, p4 in order which represent the longest possible polyline.

Judge program compares your answer and jury's answer with 10 - 6 precision.

Examples

Input

1 1


Output

1 1
0 0
1 0
0 1


Input

0 10


Output

0 1
0 10
0 0
0 9

Solution (in JAVA):

Solution:

import static java.util.Arrays.deepToString;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B {
    private static final boolean isDebug = false;
    int[][] pos = new int[8][2];
    double max = 0;
    int[] maxPos = null;

    void solve() throws Throwable {
        
        int N = readInt();
        int M = readInt();
        
        if(N == 0) {
            pw.println(0 + " " + 1);
            pw.println(0 + " " + M);
            pw.println(0 + " " + 0);
            pw.println(0 + " " + (M - 1));
            return;
        } else if(M == 0) {
            pw.println(1 + " " + 0);
            pw.println(N + " " + 0);
            pw.println(0 + " " + 0);
            pw.println((N-1) + " " + 0);
            return;
        }

        boolean isM = M > N;
        double sumMax = 0;
        pos[0] = new int[] {0,0};
        pos[1] = new int[] {N,M};
        if (isM) {
            pos[2] = new int[] {N - 1,M};
            pos[3] = new int[] {0,1};
            pos[4] = new int[] {1,0};
            pos[5] = new int[] {N,0};
            pos[6] = new int[] {N, M -1};
            pos[7] = new int[] {0, M};
//            pos[8] = new int[] {N, 0};
//            pos[9] = new int[] {0, M};
//            if(pos[2][0] == pos[3][0] && pos[2][1] == pos[3][1]){
//                pos[3] = new int[] {1, 0};
//            }
        } else {
            pos[2] = new int[] {N,M-1};
            pos[3] = new int[] {1,0};
            pos[4] = new int[] {0,1};
            pos[5] = new int[] {N,0};
            pos[6] = new int[] {N-1, M};
            pos[7] = new int[] {0,M};
//            pos[8] = new int[] {N, 0};
//            pos[9] = new int[] {0, M};
//            if(pos[2][0] == pos[3][0] && pos[2][1] == pos[3][1]){
//                pos[3] = new int[] {0, 1};
//            }
        }

//        System.out.println(pos[0][0] + " " + pos[0][1]);
//        System.out.println(pos[1][0] + " " + pos[1][1]);
//        System.out.println(pos[2][0] + " " + pos[2][1]);
//        System.out.println(pos[3][0] + " " + pos[3][1]);

        permutationAll(new int[] {0,1,2,3,4,5,6,7});
        pw.println(pos[maxPos[0]][0] + " " + pos[maxPos[0]][1]);
        pw.println(pos[maxPos[1]][0] + " " + pos[maxPos[1]][1]);
        pw.println(pos[maxPos[2]][0] + " " + pos[maxPos[2]][1]);
        pw.println(pos[maxPos[3]][0] + " " + pos[maxPos[3]][1]);
        
//        System.out.println(maxPos[0]);
//        System.out.println(maxPos[1]);
//        System.out.println(maxPos[2]);
//        System.out.println(maxPos[3]);
//        System.out.println(max);
//        boolean isEqual = M == N;
//        pw.println((isM ? (N - 1) : N) + " " + (isM ? M : (M -1)));
//        pw.println(0 + " " + 0);
//        pw.println(N  + " " + M);
//        if(isEqual) {
//            pw.println(0 + " " + 1);
//        } else {
//            pw.println((isM ? 0 : 1) + " " + (isM ? 1 : 0));
//        }
//        
        
    
    }

    private static long gcd(long n1, long n2) {
        return (n2 == 0)?n1:gcd(n2, n1%n2);
    }

    private static int gcd(int n1, int n2) {
        return (n2 == 0)?n1:gcd(n2, n1%n2);
    }

    static long startTime;
    public static void main(String[] args) {
        B app = new B();
        try {
            app.br = new BufferedReader(new InputStreamReader(System.in));
            app.solve();
        } catch(Throwable e) {
            e.printStackTrace();
        } finally {
            try { app.br.close();} catch (Exception igunore) {}
        }
        d(System.currentTimeMillis() - startTime + " ms");
        pw.flush();
        pw.close();
    }

    static final void d(Object ... o) {
        if (isDebug) pw.println(deepToString(o));
    }

    void permutationAll(int[] p) {
        permutation(p, 0, p.length - 1);
    }

    void permutationRange(int from, int to) {
        int cnt = to - from + 1;
        int[] elements = new int[cnt];
        for (int i = 0 ; i <  cnt; i++) elements[i] = from++;
        permutation(elements, 0, cnt - 1);
    }

    void permutation(int[] elements, int nowCnt, int totalCnt) {
        if (nowCnt == totalCnt) { 
            double sum = 0;
            int p1 = elements[0];
            int p2 = elements[1];
            int p3 = elements[2];
            int p4 = elements[3];
            if(pos[p1][0] == pos[p2][0] && pos[p1][1] == pos[p2][1]) return;
            if(pos[p1][0] == pos[p3][0] && pos[p1][1] == pos[p3][1]) return;
            if(pos[p1][0] == pos[p4][0] && pos[p1][1] == pos[p4][1]) return;
            if(pos[p2][0] == pos[p3][0] && pos[p2][1] == pos[p3][1]) return;
            if(pos[p2][0] == pos[p4][0] && pos[p2][1] == pos[p4][1]) return;
            if(pos[p3][0] == pos[p4][0] && pos[p3][1] == pos[p4][1]) return;

            double seg1 = Math.sqrt(Math.pow(pos[p1][0] - pos[p2][0], 2) + Math.pow(pos[p1][1] - pos[p2][1], 2)); 
            double seg2 = Math.sqrt(Math.pow(pos[p2][0] - pos[p3][0], 2) + Math.pow(pos[p2][1] - pos[p3][1], 2)); 
            double seg3 = Math.sqrt(Math.pow(pos[p3][0] - pos[p4][0], 2) + Math.pow(pos[p3][1] - pos[p4][1], 2)); 
            sum = seg1 + seg2 + seg3;
//            System.out.println(sum + " " + p1 + " " + p2 + " " + p3 + " " + p4);

            if(max < sum) {
                max = sum;
                maxPos = Arrays.copyOf(elements, 4);
            }

        } else {

            for (int i = nowCnt; i <= totalCnt; i++) {
                int tmp = elements[nowCnt]; 
                elements[nowCnt] = elements[i]; 
                elements[i] = tmp;
                permutation(elements, nowCnt+1, totalCnt);
                tmp = elements[nowCnt]; 
                elements[nowCnt] = elements[i]; 
                elements[i] = tmp;
            }
        }
    }

    static PrintWriter pw = new PrintWriter(System.out);

    private BufferedReader br = null;
    private StringTokenizer st = null;
    private String delimiter = null;
    
    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            if(delimiter != null) {
                st = new StringTokenizer(readLine(), delimiter);
            } else {
                st = new StringTokenizer(readLine());
            }
        }
        return st.nextToken();
    }

    public void close() {
        try {
            this.br.close();
        } catch(IOException ioe) {
            ioe.printStackTrace();
        }
    }

    public final String readString() {
        return next();
    }
    public final int readInt()  {
        return Integer.parseInt(next());
    }
    public final long readLong()  {
        return Long.parseLong(next());
    }
    public final double readDouble()  {
        return Double.parseDouble(next());
    }

    public final int[] readIntArray()  {
        String[] s = readStrArray();
        int cnt = s.length;
        int[] out = new int[cnt];
        for (int i = 0; i < cnt; i++) out[i] = Integer.parseInt(s[i]);
        return out;
    }
    public final long[] readLongArray()  {
        String[] s = readStrArray();
        int cnt = s.length;
        long[] out = new long[cnt];
        for (int i = 0; i < cnt; i++) out[i] = Long.parseLong(s[i]);
        return out;
    }

    public final int[] readIntColumnArray(int N)  {
        int[] res = new int[N];
        for (int i = 0; i < N; i++) {
            res[i] = readInt();
        } 
        return res;
    }
    
    public final int[][] readIntMatrix(int N) {
        int[][] res = new int[N][];
        for (int i = 0; i < N; i++) {
            res[i] = readIntArray();
        }
        return res;
    }
    
    public final char[][] readCharMatrix(int N) {
        char[][] res = new char[N][];
        for (int i = 0; i < N; i++) {
            res[i] = readCharArray();
        }
        return res;
    }

    public final char[] readCharArray()  {
        String[] s = readStrArray();
        int cnt = s.length;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < cnt; i++) sb.append(s[i]);
        return sb.toString().toCharArray();
    }
    

    public final String[] readStrArray()  {
      List<String> res = new ArrayList<String>();
      StringTokenizer st = new StringTokenizer(readLine(), " ");
      while (st.hasMoreTokens()) {
          res.add(st.nextToken());
      }
      return res.toArray(new String[0]);
    }

    public void setDelimiter(String delim) {
        this.delimiter = delim;
    }
    
    public String getDelimiter() {
        return this.delimiter;
    }

    private String readLine() {
        try {
            return br.readLine();
        } catch(IOException ioe) {
            ioe.printStackTrace();
            throw new RuntimeException(ioe);
        }
    }
}