#!/usr/bin/python

import sys, re, os

def decode():
    f = open("./coupon.html");
    html = f.read() 
    html = html.replace("\n", "")
    html = html.replace("_1nkNDs", "\n\n_1nkNDs")
    # print(html);

    count = 0;
    total = 0;
    matches = re.findall('฿(\d*\.?\d*).*?ShopeePay', html)
    for match in matches :
        total += float(match);
        count += 1;
    print("count = %d, total = %d" %(count, total));

if __name__ == '__main__':
    decode();
