import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    }

    public static class Reader implements AutoCloseable {

        private BufferedReader br;

        private String[] buf;

        private int bufidx = -1;

        public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        }

        @Override
        public void close() throws Exception {
            br.close();
        }

        private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        }

        public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        }

        public int i() throws IOException {
            return Integer.parseInt(s());
        }

        public long l() throws IOException {
            return Long.parseLong(s());
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        }

        public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        }

        public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        }

        public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        }

        public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        }

        public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        }

        public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        }

    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {

    public static void main(String[] args) throws Exception {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    }

    public static class Reader implements AutoCloseable {

        private BufferedReader br;

        private String[] buf;

        private int bufidx = -1;

        public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        }

        @Override
        public void close() throws Exception {
            br.close();
        }

        private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        }

        public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        }

        public int i() throws IOException {
            return Integer.parseInt(s());
        }

        public long l() throws IOException {
            return Long.parseLong(s());
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        }

        public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        }

        public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        }

        public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        }

        public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        }

        public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        }

        public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        }

    }

} Main public static void main(String[] args) throws Exception {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    } main {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    } try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        } {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        } Reader r = new Reader(System.in) Reader r = new Reader(System.in) new Reader(System.in) int N = r.i(); N r.i() r.i r int[] W = r.ia(); W r.ia() r.ia r int sum = Arrays.stream(W).sum(); sum Arrays.stream(W).sum() Arrays.stream(W).sum Arrays.stream(W) Arrays.stream Arrays W int min = sum; min sum int S1 = 0; S1 0 for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            } {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            } S1 += W[i] S1 W[i] W i min = Math.min(min, Math.abs(sum - S1 - S1)) min Math.min(min, Math.abs(sum - S1 - S1)) Math.min Math min Math.abs(sum - S1 - S1) Math.abs Math sum - S1 - S1 sum - S1 - S1 sum S1 S1 System.out.println(min) System.out.println System.out System System.out min String[] args args public static class Reader implements AutoCloseable {

        private BufferedReader br;

        private String[] buf;

        private int bufidx = -1;

        public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        }

        @Override
        public void close() throws Exception {
            br.close();
        }

        private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        }

        public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        }

        public int i() throws IOException {
            return Integer.parseInt(s());
        }

        public long l() throws IOException {
            return Long.parseLong(s());
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        }

        public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        }

        public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        }

        public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        }

        public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        }

        public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        }

        public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        }

    } Reader private BufferedReader br; br private String[] buf; buf private int bufidx = -1; bufidx -1 1 public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        } Reader {
            this.br = new BufferedReader(new InputStreamReader(in));
        } this.br = new BufferedReader(new InputStreamReader(in)) this.br this this.br new BufferedReader(new InputStreamReader(in)) InputStream in in @Override
        public void close() throws Exception {
            br.close();
        } close {
            br.close();
        } br.close() br.close br private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        } readBuf {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        } if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            } bufidx == -1 || bufidx == buf.length bufidx == -1 bufidx -1 1 bufidx == buf.length bufidx buf.length buf buf.length {
                buf = br.readLine().split(" ");
                bufidx = 0;
            } buf = br.readLine().split(" ") buf br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " bufidx = 0 bufidx 0 public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        } s {
            readBuf();
            return buf[bufidx++];
        } readBuf() readBuf return buf[bufidx++]; buf[bufidx++] buf bufidx++ bufidx public int i() throws IOException {
            return Integer.parseInt(s());
        } i {
            return Integer.parseInt(s());
        } return Integer.parseInt(s()); Integer.parseInt(s()) Integer.parseInt Integer s() s public long l() throws IOException {
            return Long.parseLong(s());
        } l {
            return Long.parseLong(s());
        } return Long.parseLong(s()); Long.parseLong(s()) Long.parseLong Long s() s public double d() throws IOException {
            return Double.parseDouble(s());
        } d {
            return Double.parseDouble(s());
        } return Double.parseDouble(s()); Double.parseDouble(s()) Double.parseDouble Double s() s public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        } sa {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        } readBuf() readBuf if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            } bufidx != 0 bufidx 0 {
                throw new RuntimeException("illegal read");
            } throw new RuntimeException("illegal read"); new RuntimeException("illegal read") bufidx = -1 bufidx -1 1 return buf; buf public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        } ia {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        } String[] sa = sa(); sa sa() sa int[] ia = new int[sa.length]; ia new int[sa.length] sa.length sa sa.length for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            } int i = 0; int i = 0; i 0 i < sa.length i sa.length sa sa.length i++ i++ i {
                ia[i] = Integer.parseInt(sa[i]);
            } {
                ia[i] = Integer.parseInt(sa[i]);
            } ia[i] = Integer.parseInt(sa[i]) ia[i] ia i Integer.parseInt(sa[i]) Integer.parseInt Integer sa[i] sa i return ia; ia public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        } la {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        } String[] sa = sa(); sa sa() sa long[] la = new long[sa.length]; la new long[sa.length] sa.length sa sa.length for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            } int i = 0; int i = 0; i 0 i < sa.length i sa.length sa sa.length i++ i++ i {
                la[i] = Long.parseLong(sa[i]);
            } {
                la[i] = Long.parseLong(sa[i]);
            } la[i] = Long.parseLong(sa[i]) la[i] la i Long.parseLong(sa[i]) Long.parseLong Long sa[i] sa i return la; la public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        } da {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        } String[] sa = sa(); sa sa() sa double[] da = new double[sa.length]; da new double[sa.length] sa.length sa sa.length for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            } int i = 0; int i = 0; i 0 i < sa.length i sa.length sa sa.length i++ i++ i {
                da[i] = Double.parseDouble(sa[i]);
            } {
                da[i] = Double.parseDouble(sa[i]);
            } da[i] = Double.parseDouble(sa[i]) da[i] da i Double.parseDouble(sa[i]) Double.parseDouble Double sa[i] sa i return da; da public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        } im {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        } int[][] im = new int[N][]; im new int[N][] N for (int i = 0; i < N; i++) {
                im[i] = ia();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                im[i] = ia();
            } {
                im[i] = ia();
            } im[i] = ia() im[i] im i ia() ia return im; im int N N public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        } lm {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        } long[][] lm = new long[N][]; lm new long[N][] N for (int i = 0; i < N; i++) {
                lm[i] = la();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                lm[i] = la();
            } {
                lm[i] = la();
            } lm[i] = la() lm[i] lm i la() la return lm; lm int N N public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        } dm {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        } double[][] dm = new double[N][]; dm new double[N][] N for (int i = 0; i < N; i++) {
                dm[i] = da();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                dm[i] = da();
            } {
                dm[i] = da();
            } dm[i] = da() dm[i] dm i da() da return dm; dm int N N AutoCloseable public class Main {

    public static void main(String[] args) throws Exception {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    }

    public static class Reader implements AutoCloseable {

        private BufferedReader br;

        private String[] buf;

        private int bufidx = -1;

        public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        }

        @Override
        public void close() throws Exception {
            br.close();
        }

        private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        }

        public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        }

        public int i() throws IOException {
            return Integer.parseInt(s());
        }

        public long l() throws IOException {
            return Long.parseLong(s());
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        }

        public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        }

        public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        }

        public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        }

        public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        }

        public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        }

        public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        }

    }

} public class Main {

    public static void main(String[] args) throws Exception {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    }

    public static class Reader implements AutoCloseable {

        private BufferedReader br;

        private String[] buf;

        private int bufidx = -1;

        public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        }

        @Override
        public void close() throws Exception {
            br.close();
        }

        private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        }

        public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        }

        public int i() throws IOException {
            return Integer.parseInt(s());
        }

        public long l() throws IOException {
            return Long.parseLong(s());
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        }

        public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        }

        public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        }

        public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        }

        public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        }

        public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        }

        public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        }

    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Reader r = new Reader(System.in)) {
            int N = r.i();
            int[] W = r.ia();

            int sum = Arrays.stream(W).sum();

            int min = sum;
            int S1 = 0;
            for (int i = 0; i < N; i++) {
                S1 += W[i];
                min = Math.min(min, Math.abs(sum - S1 - S1));
            }

            System.out.println(min);
        }
    }

    public static class Reader implements AutoCloseable {

        private BufferedReader br;

        private String[] buf;

        private int bufidx = -1;

        public Reader(InputStream in) {
            this.br = new BufferedReader(new InputStreamReader(in));
        }

        @Override
        public void close() throws Exception {
            br.close();
        }

        private void readBuf() throws IOException {
            if (bufidx == -1 || bufidx == buf.length) {
                buf = br.readLine().split(" ");
                bufidx = 0;
            }
        }

        public String s() throws IOException {
            readBuf();
            return buf[bufidx++];
        }

        public int i() throws IOException {
            return Integer.parseInt(s());
        }

        public long l() throws IOException {
            return Long.parseLong(s());
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public String[] sa() throws IOException {
            readBuf();
            if (bufidx != 0) {
                throw new RuntimeException("illegal read");
            }
            bufidx = -1;
            return buf;
        }

        public int[] ia() throws IOException {
            String[] sa = sa();
            int[] ia = new int[sa.length];
            for (int i = 0; i < sa.length; i++) {
                ia[i] = Integer.parseInt(sa[i]);
            }
            return ia;
        }

        public long[] la() throws IOException {
            String[] sa = sa();
            long[] la = new long[sa.length];
            for (int i = 0; i < sa.length; i++) {
                la[i] = Long.parseLong(sa[i]);
            }
            return la;
        }

        public double[] da() throws IOException {
            String[] sa = sa();
            double[] da = new double[sa.length];
            for (int i = 0; i < sa.length; i++) {
                da[i] = Double.parseDouble(sa[i]);
            }
            return da;
        }

        public int[][] im(int N) throws IOException {
            int[][] im = new int[N][];
            for (int i = 0; i < N; i++) {
                im[i] = ia();
            }
            return im;
        }

        public long[][] lm(int N) throws IOException {
            long[][] lm = new long[N][];
            for (int i = 0; i < N; i++) {
                lm[i] = la();
            }
            return lm;
        }

        public double[][] dm(int N) throws IOException {
            double[][] dm = new double[N][];
            for (int i = 0; i < N; i++) {
                dm[i] = da();
            }
            return dm;
        }

    }

}
