#!/bin/sh paste -sd+ /dev/stdin | sed 's/++/\n/g' | bc | sort -n # ./main.sh < input2.txt | tail -3 | paste -sd+ - | bc