using System.Collections.Generic;
public static class Program
static Func<long, string> remainder = t => t > 0 ? " " + ToEN(t) : "";
public static string ToEN(this long val, double d = 20, long th = 20)
case 20: return val >= d ? ToEN(val, 1e2) : en[val];
case 100: return val >= d ? ToEN(val, 1e3, 100) : en[val / 10 * 10] + remainder(val % 10);
default: return val >= d ? ToEN(val, d * 1e3,(long)d) : ToEN(val / th) + " " + en[th] + remainder(val % th);
public static void Main(string[] args)
Console.WriteLine(long.MaxValue.ToEN());
Console.WriteLine((long.MaxValue / 2).ToEN());
Console.WriteLine(66666662L.ToEN());
static readonly Dictionary<long, string> en = new Dictionary<long, string> {
{(long)1e12, "trillion"},
{(long)1e15, "quadrillion"},
{(long)1e18, "quintillion"}