#!/usr/bin/perl -w
use CGI qw(param);

print "Content-type: text/html\n\n";
print "<html><head><title>6 distinct points</title></head><body bgcolor=white>\n";

my $cnfg = param("config");
my $mult1 = param("m1");
my $mult2 = param("m2");
my $mult3 = param("m3");
my $mult4 = param("m4");
my $mult5 = param("m5");
my $mult6 = param("m6");

$cnfg=int($cnfg);
$mult1=int($mult1);
$mult2=int($mult2);
$mult3=int($mult3);
$mult4=int($mult4);
$mult5=int($mult5);
$mult6=int($mult6);

print "Here is the configuration you entered: <br>\n";
print "$cnfg<br>\n";

if($cnfg > 11 || $cnfg < 1) {
print "You did not enter a valid value for the configuration.<br>\n";
print "Thus configuration 37 will be used by default.<br>\n";
$cnfg=37;
}

print "Here are the multiplicities you entered: <br>\n";
print "$mult1, $mult2, $mult3, $mult4, $mult5, $mult6<br>\n";

if(int($mult1) > 30) {
print "Your value for m<sub>1</sub><br> is too large. Thus m<sub>1</sub> = 3 will be used by default.<br>\n";
$mult1=3;
}

if(int($mult2) > 30) {
print "Your value for m<sub>2</sub><br> is too large. Thus m<sub>2</sub> = 3 will be used by default.<br>\n";
$mult2=3;
}

if(int($mult3) > 30) {
print "Your value for m<sub>3</sub><br> is too large. Thus m<sub>3</sub> = 3 will be used by default.<br>\n";
$mult3=3;
}

if(int($mult4) > 30) {
print "Your value for m<sub>4</sub><br> is too large. Thus m<sub>4</sub> = 3 will be used by default.<br>\n";
$mult4=3;
}

if(int($mult5) > 30) {
print "Your value for m<sub>5</sub><br> is too large. Thus m<sub>5</sub> = 3 will be used by default.<br>\n";
$mult5=3;
}

if(int($mult6) > 30) {
print "Your value for m<sub>6</sub><br> is too large. Thus m<sub>6</sub> = 3 will be used by default.<br>\n";
$mult6=3;
}


print "<pre>";
system("echo $cnfg $mult1 $mult2 $mult3 $mult4 $mult5 $mult6 | awk -f Res6pointDistPts");
print "</pre>";

print "</body></html>\n";



