#!/usr/bin/perl
####
#### cat Jesse_20240513-order.csv | ./magic-script-start-girls-2.pl 
####
my $len = $#ARGV;
my $n = 0;
my $nl = 0;

while(my $line = <STDIN>) {
	### FIXME : both patterns

	my ( $pat1 ) = $line =~ /\+(\d)/; 
	my ( $pat3 ) = $1; 
	my ( $pat2 ) = $line =~ /\+(\d)/; 
	### same $1 ! 
	my ( $pat4 ) = $1; 


	### if ($line =~ /\+\d/ or $line =~ /\+\d/) { ###  or @ARGV[$i] =~ /\+[0-9] \+*/) {
	if ($pat1 or $pat2) { ###  or @ARGV[$i] =~ /\+[0-9] \+*/) {

		### float pattern (number)
		my ( $flpattern ) = $line =~ m/(\d+,\d+)/i; 
		if (defined($flpattern)) {

			my $frac = 1;
			my $number = ($flpattern * $pat3);
			my $number2 = ($flpattern * $pat4);
 
			### $flpattern .= "\n";
			### print $flpattern;

			#my $pat1n = 0;
			#my $pat2n = 0;


			### print $pat1;

			if ($pat3 == 0 and $pat4 == 0) {
				next;
			} else {
				### secure programming *lol*
				if ($pat3 != 0) {
					$n += $number;
				} 
				if ($pat4 != 0) {
					$n += $number2;
				}
			}			
		}
	}		
	if ($pat3 != 0) {
		$nl += $pat3;
	} 
	if ($pat4 != 0) {
		$nl += $pat4;
	}
	###$nl+= $number;
	###$nl+= $number2;
}

print "Price is : ";
print $n;
print " (for ";
print $nl;
print " cards).\n";
1;
