local ffi = require 'ffi' local M = ffi.load 'ssl' ffi.cdef [[ typedef struct bignum_st { uint64_t *d; int top; int dmax; int neg; int flags; } BN; typedef BN * BN_ptr; typedef const BN * BN_srcptr; BN_ptr BN_new(void); void BN_free(BN_ptr); int BN_set_word(BN_ptr, uint64_t); int BN_mul_word(BN_ptr, uint64_t); char * BN_bn2dec(BN_srcptr); void CRYPTO_free(void *, const char *, int); ]] print((function (n) if n>=50 then return "000000000000" end local b=ffi.gc(M.BN_new(),M.BN_free) M.BN_set_word(b,1) for i=2,n do M.BN_mul_word(b,i+0ULL) end return ffi.string(ffi.gc(M.BN_bn2dec(b),function (a) M.CRYPTO_free(a,"",0) end)):sub(-12) end)(io.stdin:read("*n")))