#!/usr/bin/perl use strict; use warnings; use Getopt::Std; getopts( 's', \my %opt ); print( ( $ARGV[ 1 ] - $ARGV[ 0 ] + $opt{ s } ? 1 : 0 ) * ( $ARGV[ 0 ] + $ARGV[ 1 ] + $opt{ s } ? 0 : 1 ) / 2, "\n" );