factorial = (1..10).inject(Object) {|p,n| Class.new(p) {define_method("a#{n}") {n}}}.new
puts (1..10).map {|n| factorial.send("a#{n}")}.inject(:*)
ZmFjdG9yaWFsID0gKDEuLjEwKS5pbmplY3QoT2JqZWN0KSB7fHAsbnwgQ2xhc3MubmV3KHApIHtkZWZpbmVfbWV0aG9kKCJhI3tufSIpIHtufX19Lm5ldwoKcHV0cyAoMS4uMTApLm1hcCB7fG58IGZhY3RvcmlhbC5zZW5kKCJhI3tufSIpfS5pbmplY3QoOiop