// Problem: P6739 [BalticOI 2014 Day1] Three Friends // Contest: Luogu // URL: https://www.luogu.com.cn/problem/P6739 // Memory Limit: 256 MB // Time Limit: 500 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> usingnamespace std; #define int long long inlineintread(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} #define N 2000010 //#define M #define mo 1000000009 int n, m, i, j, k; char s[N]; int a[N], f[N], mid; int l, r;
intMOD(int x) { return (x%mo+mo)%mo; }
intqiu(int l, int r) { if(l>r) return0; returnMOD(a[r]-a[l-1]*f[r-l+1]); }