package ua.nure.jfn.task1;

public class Part1 {
	public static void main(String[] args) {
		int numbersSum = 0;
		int digitsSum = 0;

		for (String arg : args) {
			int digitPlace = 0;
			char[] chArray = arg.toCharArray();
			for (int i = chArray.length - 1; i >= 0; i--) {
				char ch = chArray[i];
				if (ch >= '0' && ch <= '9') {
					digitsSum += ch - '0';
					numbersSum += (ch - '0') * pow(10, digitPlace++);
				} else {
					digitPlace = 0;
				}
			}
		}

		System.out.printf("%d %d\n", numbersSum, digitsSum);
	}

	static int pow(int num, int power) {
		int result = 1;
		for (int i = 0; i < power; i++) {
			result *= num;
		}

		return result;
	}
}
