fIn = 'queries.txt'

lenXTile = 100.0
lenYTile = 100.0
sizeTile = 4

fdIn = open(fIn, 'r')
total = 0.0
for line in fdIn:
    tmpLine = line.split('\t')
    tmpQuery = tmpLine[4].split('/')[1:-1]
    xDiff = float(tmpQuery[2]) - float(tmpQuery[0]) 
    yDiff = float(tmpQuery[3]) - float(tmpQuery[1]) 
    xTiles = xDiff/lenXTile
    yTiles = yDiff/lenYTile
    if 'REFL' in tmpLine[4]: total += xTiles * yTiles * sizeTile
    elif 'DDOP' in tmpLine[4]: total += 2 * xTiles * yTiles * sizeTile
    elif 'NBRR' in tmpLine[4]: total += 3 * xTiles * yTiles * sizeTile
    elif 'QPE' in tmpLine[4]: total += 9 * xTiles * yTiles * sizeTile
    elif 'NCAS' in tmpLine[4]: total += 6 * xTiles * yTiles * sizeTile
print total
