public static int sumNumbers(TreeNode root) {
        if(root == null) return 0;
        if(root.left == null && root.right ==null) return root.val;
        ArrayList<Integer> list = new ArrayList<Integer>();
        countLeft(list, root.left, root.val);
        countRight(list, root.right, root.val);
        int sum = 0;
		for(int num: list){
			sum += num;
		}
        return sum;
    }