#!/usr/bin/python
print "Content-type:text/html\n\n"

"""
Henry Zheng
IntroCS2 pd8
HW#53 -- GET Some Computation Done
2016-05-25
"""

import os
d = os.environ

def area():
    query = d["QUERY_STRING"]
    query = query.split('&')
    if len(query) != 3:
        print "ERR: Not a triangle"
    for sidelength in query:
        sidelength = sidelength.split("=")
        if sidelength[0] == "a":
            a = float(sidelength[1])
        if sidelength[0] == "b":
            b = float(sidelength[1])
        if sidelength[0] == "c":
            c = float(sidelength[1])
    perimeter = a+b+c
    print "Perimeter = " + str(perimeter) + "<br>"
    semiperimeter = perimeter/2.0
    s = semiperimeter
    area = (s*(s-a)*(s-b)*(s-c))**(1.0/2.0)
    print "Area = " + str(area)

area()
