#include <cstdio>
#include <cstring>

#define mlen 303

struct money
{
  int val;
  char s[mlen];
};

money en[] = 
{
  {1, "one"},
  {2, "two"},
  {3,"three"},
  {4, "four"},
  {5, "five"},
  {6, "six"},
  {7, "seven"},
  {8, "eight"},
  {9, "nine"},
  {10, "ten"},
  {11, "eleven"},
  {12, "twelve"},
  {13, "thirteen"},
  {14, "fourteen"},
  {15, "fifteen"},
  {16, "sixteen"},
  {17, "seventeen"},
  {18, "eighteen"},
  {19, "nineteen"},
  {20, "twenty"},
  {30, "thirty"},
  {40, "forty"},
  {50, "fifty"},
  {60, "sixty"},
  {70, "seventy"},
  {80, "eighty"},
  {90, "ninety"},
};

money rus[] =
{
  {1, "один"},
  {2, "два"},
  {3, "три"},
  {4, "четыре"},
  {5, "пять"},
  {6, "шесть"},
  {7, "семь"},
  {8, "восемь"},
  {9, "девять"},
  {10, "десять"},
  {11, "одиннадцать"},
  {12, "двенадцать"},
  {13, "тринадцать"},
  {14, "четырнадцать"},
  {15, "пятнадцать"},
  {16, "шестнадцать"},
  {17, "семнадцать"},
  {18, "восемнадцать"},
  {19, "девятнадцать"},
  {20, "двадцать"},
  {30, "тридцать"},
  {40, "сорок"},
  {50, "пятьдесят"},
  {60, "шестьдесят"},
  {70, "семьдесят"},
  {80, "восемьдесят"},
  {90, "девяносто"},
  {100, "сто"},
  {200, "двести"},
  {300, "триста"},
  {400, "четыреста"},
  {500, "пятьсот"},
  {600, "шестьсот"},
  {700, "семьсот"},
  {800, "восемьсот"},
  {900, "девятьсот"},
};

int main()
{
  int k, sum = 0;
  char s[mlen];

  freopen("money.in", "r", stdin);
  freopen("money.out", "w", stdout);

  scanf("%d", &k);
  while (scanf("%s", s) == 1 && s[0] != 'd')
    for (int i = 0; i < 27; i++)
      if (strcmp(s, en[i].s) == 0)
        sum += en[i].val;

  sum *= k, k = sum;
  for (int i = 35; i >= 0; i--)
    if (sum >= rus[i].val)
      printf("%s ", rus[i].s), sum -= rus[i].val;
  if (k % 10 == 1)
    printf("рубль\n");
  else if (2 <= k % 10 && k % 10 <= 4 && (k / 10) % 10 != 1)
    printf("рубля\n");
  else
    printf("рублей\n");
  return 0;
}