C++ Solution | Using logarithm property
Approach\n1. remove all 2\'s and 5\'s while multiplying numbers and count how many times 2\'s and 5\'s appear\n2. number of zeros will be equal to min(two,five)
**Approach**\n1. remove all 2\'s and 5\'s while multiplying numbers and count how many times 2\'s and 5\'s appear\n2. number of zeros will be equal to ```min(two,five)```\n3. get original number back by multiplying extra occurence of two or five\n4. we maintain two numbers ```original``` and ```suffix``` by taking modulus with different numbers. If our final product has 10 or less digits then ```original``` value is equal to the ```suffix``` value otherwise we take last five digits of ```suffix```.\n5. to get first 5 digits we take ```log``` of all values from ```left``` to ```right``` and add them all. Coz we need only first five digits of number we take ```10^(4+fraction part)```\n\n**Time Complexity :** **O(n),** **where n=(right-left)**\n\n```\nclass Solution\n{\n    public:\n    void reduceNumber(unsigned long long& val,unsigned long long x,unsigned long long& count)\n    {\n        while (val%x==0)\n        {\n            val/=x;\n            count++;\n        }\n    }\n    void getBackOriginal(unsigned long long& val,unsigned long long two,unsigned long long five,unsigned long long& mod)\n    {\n        if (two<five)\n        {\n            five-=two;\n            while (five--)\n                val=(val*5)%mod;\n        }\n        else if (five<two)\n        {\n            two-=five;\n            while (two--)\n                val=(val*2)%mod;\n        }\n    }\n    string abbreviateProduct(int left, int right)\n    {\n        unsigned long long original=1,suffix=1,two=0,five=0,mod1=1e10,mod2=1e13;\n        double power=0;\n        for (long long i=left;i<=right;i++)\n        {\n            unsigned long long val=i;\n            power=power+(double)(log10(i));\n            \n            //Reduce number by removing multiple of 2 and 5 from them and count them\n            reduceNumber(val,2,two);\n            reduceNumber(val,5,five);\n            \n            //Maintain two number suffix and original by taking modulus with different numbers\n            suffix=(suffix*val)%mod1;\n            original=(original*val)%mod2;\n        }\n        \n        //Get original number back by multiplying extra two or five\n        getBackOriginal(suffix,two,five,mod1);\n        getBackOriginal(original,two,five,mod2);\n        \n        string ans="";\n        //If suffix is equal to original it means final product has 10 or maybe less digits\n        if (original==suffix)\n            ans=to_string(original)+\'e\'+to_string(min(two,five));\n        else\n        {\n            power=power-(int)(power)+4.0;\n            long long prefix=pow(10,power);\n            string temp=to_string(suffix);\n            for (int i=temp.length()-1;i>temp.length()-6;i--)\n                ans=temp[i]+ans;\n            ans=to_string(prefix)+"..."+ans+\'e\'+to_string(min(two,five));\n        }\n        return ans;\n    }\n};\n```
[]