integer N
character(100000) S
integer CNT(26)
integer tmp
integer(16) ans
read*,N
read*,S

!実に読みづらい名前になってしまった
!各文字がどこにいられるかの場所
CNT=1
do i=1,N
  tmp=ichar(S(i:i))-ichar("a")+1
  CNT(tmp)=Cnt(tmp)+1
end do
ans=1
do i=1,26
  ans=mod(ans*cnt(i),10**9+7)
end do
ans=ans-1
print"(i0)",ans
end
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEcnt = internal unnamed_addr global [26 x i32] undef
@_QFEs = internal global [100000 x i8] undef
@_QQcl.9032fd82bf5cf2313bafb0a7365dd942 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4697/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9032fd82bf5cf2313bafb0a7365dd942, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9032fd82bf5cf2313bafb0a7365dd942, i32 7)
  %6 = call i1 @_FortranAioInputAscii(ptr %5, ptr nonnull @_QFEs, i64 100000)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %5)
  store i32 1, ptr @_QFEcnt, align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 1), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 2), align 8, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 3), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 4), align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 5), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 6), align 8, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 7), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 8), align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 9), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 10), align 8, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 11), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 12), align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 13), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 14), align 8, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 15), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 16), align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 17), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 18), align 8, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 19), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 20), align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 21), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 22), align 8, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 23), align 4, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 24), align 16, !tbaa !3
  store i32 1, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 25), align 4, !tbaa !3
  %8 = load i32, ptr %1, align 4, !tbaa !3
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %0
  %10 = zext i32 %8 to i64
  %xtraiter = and i64 %10, 1
  %11 = icmp eq i32 %8, 1
  br i1 %11, label %.preheader.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %10, 4294967294
  br label %.lr.ph

.preheader.loopexit.unr-lcssa.loopexit:           ; preds = %.lr.ph
  %12 = add nuw nsw i64 %indvars.iv, 1
  br label %.preheader.loopexit.unr-lcssa

.preheader.loopexit.unr-lcssa:                    ; preds = %.preheader.loopexit.unr-lcssa.loopexit, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %12, %.preheader.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader.loopexit.unr-lcssa
  %13 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %indvars.iv.unr
  %.unpack.epil = load i8, ptr %13, align 1, !tbaa !3
  %14 = zext i8 %.unpack.epil to i64
  %15 = add nsw i64 %14, -97
  %16 = getelementptr [26 x i32], ptr @_QFEcnt, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !3
  %18 = add i32 %17, 1
  store i32 %18, ptr %16, align 4, !tbaa !3
  br label %.preheader.loopexit

.preheader.loopexit:                              ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph.epil
  %.pre = load i32, ptr @_QFEcnt, align 16, !tbaa !3
  %.pre17 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 1), align 4, !tbaa !3
  %.pre18 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 2), align 8, !tbaa !3
  %.pre19 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 3), align 4, !tbaa !3
  %.pre20 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 4), align 16, !tbaa !3
  %.pre21 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 5), align 4, !tbaa !3
  %.pre22 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 6), align 8, !tbaa !3
  %.pre23 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 7), align 4, !tbaa !3
  %.pre24 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 8), align 16, !tbaa !3
  %.pre25 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 9), align 4, !tbaa !3
  %.pre26 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 10), align 8, !tbaa !3
  %.pre27 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 11), align 4, !tbaa !3
  %.pre28 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 12), align 16, !tbaa !3
  %.pre29 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 13), align 4, !tbaa !3
  %.pre30 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 14), align 8, !tbaa !3
  %.pre31 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 15), align 4, !tbaa !3
  %.pre32 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 16), align 16, !tbaa !3
  %.pre33 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 17), align 4, !tbaa !3
  %.pre34 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 18), align 8, !tbaa !3
  %.pre35 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 19), align 4, !tbaa !3
  %.pre36 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 20), align 16, !tbaa !3
  %.pre37 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 21), align 4, !tbaa !3
  %.pre38 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 22), align 8, !tbaa !3
  %.pre39 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 23), align 4, !tbaa !3
  %.pre40 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 24), align 16, !tbaa !3
  %.pre41 = load i32, ptr getelementptr inbounds ([26 x i32], ptr @_QFEcnt, i64 0, i64 25), align 4, !tbaa !3
  %19 = srem i32 %.pre, 1000000007
  %20 = sext i32 %19 to i64
  %21 = sext i32 %.pre17 to i64
  %22 = mul nsw i64 %20, %21
  %23 = srem i64 %22, 1000000007
  %24 = sext i32 %.pre18 to i64
  %25 = mul nsw i64 %23, %24
  %26 = srem i64 %25, 1000000007
  %27 = sext i32 %.pre19 to i64
  %28 = mul nsw i64 %26, %27
  %29 = srem i64 %28, 1000000007
  %30 = sext i32 %.pre20 to i64
  %31 = mul nsw i64 %29, %30
  %32 = srem i64 %31, 1000000007
  %33 = sext i32 %.pre21 to i64
  %34 = mul nsw i64 %32, %33
  %35 = srem i64 %34, 1000000007
  %36 = sext i32 %.pre22 to i64
  %37 = mul nsw i64 %35, %36
  %38 = srem i64 %37, 1000000007
  %39 = sext i32 %.pre23 to i64
  %40 = mul nsw i64 %38, %39
  %41 = srem i64 %40, 1000000007
  %42 = sext i32 %.pre24 to i64
  %43 = mul nsw i64 %41, %42
  %44 = srem i64 %43, 1000000007
  %45 = sext i32 %.pre25 to i64
  %46 = mul nsw i64 %44, %45
  %47 = srem i64 %46, 1000000007
  %48 = sext i32 %.pre26 to i64
  %49 = mul nsw i64 %47, %48
  %50 = srem i64 %49, 1000000007
  %51 = sext i32 %.pre27 to i64
  %52 = mul nsw i64 %50, %51
  %53 = srem i64 %52, 1000000007
  %54 = sext i32 %.pre28 to i64
  %55 = mul nsw i64 %53, %54
  %56 = srem i64 %55, 1000000007
  %57 = sext i32 %.pre29 to i64
  %58 = mul nsw i64 %56, %57
  %59 = srem i64 %58, 1000000007
  %60 = sext i32 %.pre30 to i64
  %61 = mul nsw i64 %59, %60
  %62 = srem i64 %61, 1000000007
  %63 = sext i32 %.pre31 to i64
  %64 = mul nsw i64 %62, %63
  %65 = srem i64 %64, 1000000007
  %66 = sext i32 %.pre32 to i64
  %67 = mul nsw i64 %65, %66
  %68 = srem i64 %67, 1000000007
  %69 = sext i32 %.pre33 to i64
  %70 = mul nsw i64 %68, %69
  %71 = srem i64 %70, 1000000007
  %72 = sext i32 %.pre34 to i64
  %73 = mul nsw i64 %71, %72
  %74 = srem i64 %73, 1000000007
  %75 = sext i32 %.pre35 to i64
  %76 = mul nsw i64 %74, %75
  %77 = srem i64 %76, 1000000007
  %78 = sext i32 %.pre36 to i64
  %79 = mul nsw i64 %77, %78
  %80 = srem i64 %79, 1000000007
  %81 = sext i32 %.pre37 to i64
  %82 = mul nsw i64 %80, %81
  %83 = srem i64 %82, 1000000007
  %84 = sext i32 %.pre38 to i64
  %85 = mul nsw i64 %83, %84
  %86 = srem i64 %85, 1000000007
  %87 = sext i32 %.pre39 to i64
  %88 = mul nsw i64 %86, %87
  %89 = srem i64 %88, 1000000007
  %90 = sext i32 %.pre40 to i64
  %91 = mul nsw i64 %89, %90
  %92 = srem i64 %91, 1000000007
  %93 = sext i32 %.pre41 to i64
  %94 = mul nsw i64 %92, %93
  %95 = srem i64 %94, 1000000007
  %96 = add nsw i64 %95, -1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %0
  %.lhs.trunc90 = phi i64 [ %96, %.preheader.loopexit ], [ 0, %0 ]
  %97 = sext i64 %.lhs.trunc90 to i128
  %98 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.9032fd82bf5cf2313bafb0a7365dd942, i32 21)
  %99 = call i1 @_FortranAioOutputInteger128(ptr %98, i128 %97)
  %100 = call i32 @_FortranAioEndIoStatement(ptr %98)
  ret void

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %101 = add nsw i64 %indvars.iv, -1
  %102 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %101
  %.unpack = load i8, ptr %102, align 1, !tbaa !3
  %103 = zext i8 %.unpack to i64
  %104 = add nsw i64 %103, -97
  %105 = getelementptr [26 x i32], ptr @_QFEcnt, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !3
  %107 = add i32 %106, 1
  store i32 %107, ptr %105, align 4, !tbaa !3
  %108 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %indvars.iv
  %.unpack.1 = load i8, ptr %108, align 1, !tbaa !3
  %109 = zext i8 %.unpack.1 to i64
  %110 = add nsw i64 %109, -97
  %111 = getelementptr [26 x i32], ptr @_QFEcnt, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !3
  %113 = add i32 %112, 1
  store i32 %113, ptr %111, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa.loopexit, label %.lr.ph
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger128(ptr, i128) local_unnamed_addr

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
