CF296B.Yaroslav and Two Strings

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Yaroslav thinks that two strings ss and ww , consisting of digits and having length nn are non-comparable if there are two numbers, ii and jj (1<=i,j<=n)(1<=i,j<=n) , such that s_{i}>w_{i} and s_{j}<w_{j} . Here sign sis_{i} represents the ii -th digit of string ss , similarly, wjw_{j} represents the jj -th digit of string ww .

A string's template is a string that consists of digits and question marks ("?").

Yaroslav has two string templates, each of them has length nn . Yaroslav wants to count the number of ways to replace all question marks by some integers in both templates, so as to make the resulting strings incomparable. Note that the obtained strings can contain leading zeroes and that distinct question marks can be replaced by distinct or the same integers.

Help Yaroslav, calculate the remainder after dividing the described number of ways by 10000000071000000007 (109+7)(10^{9}+7) .

输入格式

The first line contains integer nn (1<=n<=105)(1<=n<=10^{5}) — the length of both templates. The second line contains the first template — a string that consists of digits and characters "?". The string's length equals nn . The third line contains the second template in the same format.

输出格式

In a single line print the remainder after dividing the answer to the problem by number 10000000071000000007 (109+7)(10^{9}+7) .

输入输出样例

  • 输入#1

    2
    90
    09
    

    输出#1

    1
    
  • 输入#2

    2
    11
    55
    

    输出#2

    0
    
  • 输入#3

    5
    ?????
    ?????
    

    输出#3

    993531194
    

说明/提示

The first test contains no question marks and both strings are incomparable, so the answer is 11 .

The second test has no question marks, but the given strings are comparable, so the answer is 00 .

首页