#include <iostream>
#include <cmath>
using namespace std;
struct CacheItem {
CacheItem( ) = default;
CacheItem( long long k, long long v ) : key( k ), value( v ) { }
long long key;
long long value;
};
struct ListaFactoriales {
CacheItem *cache = nullptr;
int itemsInCache = 0;
void appendItemToCache( CacheItem ci ) {
if( itemsInCache != 0 ) {
CacheItem *newCache = new CacheItem[itemsInCache + 1];
for( int idx = 0; idx < itemsInCache; ++idx ) {