#!/usr/bin/env python
from sys import argv, stdin
from pylab import figure, clf, plot, show, savefig

# Collect data
lines = stdin.readlines()
x = []
y = [[] for i in range(lines[0].count(','))]
for i in range(len(lines)):
    if lines[i] == '':
        pass
    parts = lines[i].split(',', 1)
    x.append(parts[0])
    y_values = parts[1].split(',')
    for j in range(len(y_values)):
        y[j].append(y_values[j])

# Plot and optionally save data
figure(1)
clf()
for i in range(len(y)):
    plot(x, y[i], '-')
if len(argv) == 2:
    savefig(argv[1])
show()
