#! /usr/bin/env python
import sys
import os

# default distribution point
lvlranges = [0,2,6,10,20,50,100]
envranges = os.environ.get('lvlranges')
if envranges != None:
    items = envranges.split(',');
    for item in envranges:
        lvlranges.append(int(item))

def getLowPoint(value):
    lastv = lvlranges[0]
    for v in lvlranges:
        if value < v: return lastv
        else: lastv = v
    return lvlranges[-1]

#if __name__ == '__main__':
    #print getLowPoint(0)
    #print getLowPoint(1)
    #print getLowPoint(23)
    #print getLowPoint(900)
    #sys.exit(0)

for line in sys.stdin:
    # key numvalue
    items = line.strip().split("\t", 1)

    commaidx = items[0].rfind(',')
    if commaidx != -1:
        keystr = items[0][0:commaidx]
    else:
        keystr = items[0]

    numvalue = int(items[1])
    lvlcutp = getLowPoint(numvalue)

    keystr += ",%d" %(lvlcutp)
    print keystr + "\t1"
