#include <stdio.h>
#define slotCount(a,b) (a)/(b)+((a)%(b)!=0)
int main()
{
    int min, sec, kubun, price = 0, slotNum;
    int costTable[3][4] =
    {
        {1, 300, 6, 15}, {1, 240, 6, 12}, {1, 180, 6, 9}
    };

    printf("通話時間を入力せよ(分   秒)- - - - >");
    scanf("%d %d", &min, &sec);
    printf("区分を入力せよ- - - - >" );
    scanf("%d", &kubun);

    sec += (min - costTable[kubun - 1][0] ) * 60;

    price =costTable[kubun - 1][1];

    slotNum = slotCount(sec, costTable[kubun - 1][2]);
    price += slotNum * costTable[kubun - 1][3];

    printf("あなたの通話料金は¥%dです\n", price);

    return 0;
}
