public static short solution1(String[] args) throws Exception {
        short sum = 0;
        for (String arg : args) {
            String[] a = arg.split("\\s+");
            for (String anA : a) {
                if (!anA.equals("")) {
                    if (Character.toLowerCase(anA.charAt(0)) == 'q' || (anA.length() > 1 &&
                        (Character
                        .toLowerCase(
                            anA.charAt(1)) == 'q'))) {
                        boolean neg = false;
                        if (anA.charAt(0) == '-') {
                            anA = anA.substring(2);
                            neg = true;
                        } else {
                            anA = anA.substring(1);
                        }
                        if (anA.charAt(0) == '-') {
                            throw new Exception("Numbers like q-33421 are not allowed");
                        }
                        sum += neg ? (short) Integer.parseInt("-" + anA,
                                                              4) : (short) Integer.parseInt(anA, 4);

                    } else {
                        sum += (short) Integer.parseInt(anA);
                    }
                }
            }
        }
        return sum;
    }